Previous  |  Next  >  
Product: Storage Foundation Guides   
Manual: Storage Foundation 4.1 Intelligent Storage Provisioning Administrator's Guide   

Creating a Shared Cache Volume and Preparing Space-Optimized Snapshots

If you need to create several space-optimized instant snapshots for the volumes in a disk group, you may find it more convenient to create a single shared cache volume in the disk group rather than a separate cache volume for each snapshot.

To create a shared cache volume and prepare any space-optimized snapshots:

  1. Decide on the following characteristics that you want to allocate to the cache volume:

    • The size of the cache volume should be sufficient to record changes to the parent volumes during the interval between snapshot refreshes. A suggested value is 10% of the total size of the parent volumes for a refresh interval of 24 hours.
    • If redundancy is a desired characteristic of the cache volume, it should be mirrored. This increases the space required by the cache volume in proportion to the number of mirrors that it has.
    • If the cache volume is mirrored, space is required on at least as many disks as it has mirrors. These disks should not be shared with the disks used for the parent volumes. The disks should also be chosen to avoid impacting I/O performance for critical volumes, or hindering disk group split and join operations.

  2. Having decided on its characteristics, use the vxvoladm command to create the cache volume:
    # vxvoladm [-g diskgroup] [-p storage_pool] make cachevol size \
    [
    storage_specification ...] [attribute ...] [regionsize size] \
    type=cachevolume

    The attribute regionsize specifies the minimum size of each chunk (or region) of a volume whose contents are tracked for changes. The region size must be a power of 2, and be greater than or equal to 16KB. A smaller value requires more disk space for the change maps, but the finer granularity provides faster resynchronization. The default region size is 64k (64KB).

    The following example creates a 1GB mirrored cache volume, cachevol, in the clone storage pool, myclpool, within the disk group, mydg:


    vxvoladm -g mydg -p myclpool make mycache 1g \ 
      rules="mirror 2" type=cachevolume
  3. Once the cache volume has been created, use the following command to prepare each space-optimized snapshot that uses the cache volume:
    vxvoladm [-g diskgroup] [-p storage_pool] make sovol srcvol_len
    [storage_specification ...] [attribute ...] type=snapshot \
    cachevolume=
    cachevol init=active

    Note   Note    The srcvol_len argument specifies the length of the source volume for which the snapshot is being prepared. This value defines the logical size of the snapshot. The actual amount of storage that the snapshot requires is less than this, and is limited by the size of the cache volume.

    For example, this command creates a space-optimized snapshot volume that uses the cache volume, mycache:


    vxvoladm -g mydg -p myclpool make mysovol 10g type=snapshot \ 
      cachevolume=mycache
    Note   Note    The argument 10g is the size of the source volume for which the snapshot mysovol is being prepared.

    Once created, such a volume is ready for use to take a space-optimized instant snapshot.

Alternatively, you can use the following command to create a cache volume and prepare the space-optimized snapshot volumes in a single operation:


vxvoladm -M make <<!!
  volumegroup {
    diskgroup "diskgroup"
    volume "cachevol" cache_size {
      type cachevolume
      [storage_specification]
      [regionsize size]
    }
    volume "sovol1" vol1_size {
      init active
      cachevolume "cachevol"
    }
    volume "sovol2" vol2_size {
      init active
      cachevolume "cachevol"
    }
.
.
.
};
!!
Note   Note    Because of its complexity, it is recommended that you run this command as a script.

For the examples given earlier in this section, the combined form of the command would be:


vxvoladm -M make <<!!
  volumegroup {
    diskgroup "mydg"
    volume "mycache" 1g {
      type cachevolume
      capability 'DataMirroring(nmirs=2)'
    }
    volume "mysovol" 10g {
      init active
      cachevolume "cachevol"
    }
 };
!!

Tuning the autogrow Attributes

The highwatermark, autogrowby and maxautogrow attributes determine how the VxVM cache daemon (vxcached) maintains the cache if the autogrow feature has been enabled and vxcached is running:

  • When cache usage reaches the high watermark value, highwatermark (default value is 90 percent), vxcached grows the size of the cache volume by the value of autogrowby (default value is 20% of the size of the cache volume in blocks). The new required cache size cannot exceed the value of maxautogrow (default value is twice the size of the cache volume in blocks).
  • When cache usage reaches the high watermark value, and the new required cache size would exceed the value of maxautogrow, vxcached deletes the oldest snapshot in the cache. If there are several snapshots with the same age, the largest of these is deleted.

If the autogrow feature has been disabled:

  • When cache usage reaches the high watermark value, vxcached deletes the oldest snapshot in the cache. If there are several snapshots with the same age, the largest of these is deleted. If there is only a single snapshot, this snapshot is detached and marked as invalid.

  • Note   Note    The vxcached daemon does not remove snapshots that are currently open, and it does not remove the last or only snapshot in the cache.

If the cache space becomes exhausted, the snapshot is detached and marked as invalid. If this happens, the snapshot is unrecoverable and must be removed. Enabling the autogrow feature on the cache helps to avoid this situation occurring. However, for very small caches (of the order of a few megabytes), it is possible for the cache to become exhausted before the system has time to respond and grow the cache. In such cases, either increase the size of the cache manually as described in Growing and Shrinking a Cache, or use the vxcache set command to reduce the value of highwatermark for the cache object, as shown in this example:


vxcache -g mydg set highwatermark=60 cobjmydg

You can use the maxautogrow attribute to limit the maximum size to which a cache can grow. To estimate this size, consider how much the contents of each source volume are likely to change between snapshot refreshes, and allow some additional space for contingency.

If necessary, you can use the vxcache set command to change other autogrow attribute values for a cache. See the vxcache(1M) manual page for details.


Caution  Caution    Ensure that the cache is sufficiently large, and that the autogrow attributes are configured correctly for your needs.

Growing and Shrinking a Cache

You can use the vxcache command to increase the size of the cache volume that is associated with a cache object:


vxcache [-g diskgroup] growcacheto cache_object size

For example, to increase the size of the cache volume associated with the cache, mycache, to 2GB, use the following command:


vxcache -g mydg growcacheto mycache 2g

To grow a cache by a specified amount, use the following form of the command:


vxcache [-g diskgroup] growcacheby cache_object size

For example, to increase the size of the cache, mycache, by 1GB, you would use the following command:


vxcache -g mydg growcacheby mycache 1g

You can similarly use the shrinkcacheby and shrinkcacheto operations to reduce the size of a cache. See the vxcache(1M) manual page for more information.

Removing a Cache

To remove a cache completely, including the cache object, its cache volume and all space-optimized snapshots that use the cache:

  1. Run the following command to find out the names of the top-level snapshot volumes that are configured on the cache object:
    vxprint -g diskgroup -vne \
    "v_plex.pl_subdisk.sd_dm_name ~ /cache_object/"

    where cache_object is the name of the cache object.

  2. Remove all the top-level snapshots and their dependent snapshots (this can be done with a single command):
    vxedit -g diskgroup -r rm snapvol ...

    where snapvol is the name of a top-level snapshot volume.

  3. Stop the cache object:
    vxcache -g diskgroup stop cache_object
  4. Finally, remove the cache object and its cache volume:
    vxedit -g diskgroup -r rm cache_object
 ^ Return to Top Previous  |  Next  >  
Product: Storage Foundation Guides  
Manual: Storage Foundation 4.1 Intelligent Storage Provisioning Administrator's Guide  
VERITAS Software Corporation
www.veritas.com