---
title:  Keeping a Disk Store Synchronized with the Cache
---

<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<a id="syncing_offline_disk_store__section_7D01550D750E48289EFBA9BBDB5A334E"></a>
Recovering data from an offline disk store proceeds most quickly when the configuration of the offline data matches that of the online data.

Whenever you change or remove persistent regions (by modifying your cache.xml or the code that configures
the regions), then you should alter the corresponding offline disk-store to match. If you don't, then the next time
this disk-store is recovered it will recover all of that region's data into a temporary region using the
old configuration. The old configuration will still consume the old configured resources (heap
memory, off-heap memory). If those resources are no longer available (for example the old
configuration of the region was off-heap but you decide to no longer configure off-heap memory on
the JVM), the disk-store recovery will fail.

It is common practice to have more than one off-line disk store, because each member of the cluster usually has its own copy.
Be sure to apply the same `alter disk-store` command to each offline copy of the disk store.

## <a id="syncing_offline_disk_store__section_7B95B20F07BD40699CDB7F3D6A93B905" class="no-quick-link"></a>Change Region Configuration

When your disk store is offline, you can keep the configuration for its regions up-to-date with your
`cache.xml` and API settings. The disk store retains a subset of the region configuration
attributes.  (For a list of the retained attributes, see [alter
disk-store](../../tools_modules/gfsh/command-pages/alter.html#topic_99BCAD98BDB5470189662D2F308B68EB)).  If the configurations do not
match at startup, the `cache.xml` and API override any disk store settings and the disk store is
automatically updated to match. So you do not need to modify your disk store to keep your cache
configuration and disk store synchronized, but you will save startup time and memory if you do.

For example, to change the initial capacity of the region named "partitioned_region" in the disk store:

``` pre
gfsh>alter disk-store --name=myDiskStoreName --region=partitioned_region 
--disk-dirs=/firstDiskStoreDir,/secondDiskStoreDir,/thirdDiskStoreDir 
--initialCapacity=20
```

To list all modifiable settings and their current values for a region, run the command with no actions specified:

``` pre
gfsh>alter disk-store --name=myDiskStoreName --region=partitioned_region
--disk-dirs=/firstDiskStoreDir,/secondDiskStoreDir,/thirdDiskStoreDir  
```

## <a id="syncing_offline_disk_store__section_0CA17ED106394686A1A5B30601758DA6" class="no-quick-link"></a>Take a Region Out of Your Cache Configuration and Disk Store

You might remove a region from your application if you decide to rename it or to split its data into two entirely different regions. Any significant data restructuring can cause you to retire some data regions.

This applies to the removal of regions while the disk store is offline. Regions you destroy through API calls or by `gfsh` are automatically removed from the disk store of online members.

In your application development, when you discontinue use of a persistent region, remove the region from the member’s disk store as well.

**Note:**
Perform the following operations with caution. You are permanently removing data.

You can remove the region from the disk store in one of two ways:

-   Delete the entire set of disk store files. Your member will initialize with an empty set of files the next time you start it. Exercise caution when removing the files from the file system, as more than one region can be specified to use the same disk store directories.
-   Selectively remove the discontinued region from the disk store with a command such as:

    ``` pre
    gfsh>alter disk-store --name=myDiskStoreName --region=partitioned_region
    --disk-dirs=/firstDiskStoreDir,/secondDiskStoreDir,/thirdDiskStoreDir --remove
    ```

To guard against unintended data loss, <%=vars.product_name%> maintains the region in the disk store until you manually remove it. Regions in the disk stores that are not associated with any region in your application are still loaded into temporary regions in memory and kept there for the life of the member. The system has no way of detecting whether the cache region will be created by your API at some point, so it keeps the temporary region loaded and available.
