Previous  |  Next  >  
Product: Volume Manager Guides   
Manual: Volume Manager 4.1 Administrator's Guide   

Creating Instant Snapshots


Note   Note    You need a full license and a a VERITAS FlashSnapTM license to use this feature.

VxVM allows you to make instant snapshots of volumes by using the vxsnap command.


Note   Note    The information in this section also applies to RAID-5 volumes that have been converted to a special layered volume layout by the addition of a DCO and DCO volume. See Using a DCO and DCO Volume with a RAID-5 Volume for details.

A plex in a full-sized instant snapshot requires as much space as the original volume. If you instead make a space-optimized instant snapshot of a volume, this only requires enough storage to record the original contents of the parent volume as they are changed during the life of the snapshot.

The recommended approach to performing volume backup from the command line, or from a script, is to use the vxsnap command. The vxsnap prepare and make tasks allow you to back up volumes online with minimal disruption to users.

The vxsnap prepare step creates a DCO and DCO volume and associates this with the volume. It also enables Persistent FastResync on the volume.

The vxsnap make step creates an instant snapshot that is immediately available for making a backup. After the snapshot has been taken, read requests for data in the original volume are satisfied by reading either from a non-updated region of the original volume, or from the copy of the original contents of an updated region that have been recorded by the snapshot.


Note   Note    Synchronization of a full-sized instant snapshot from the original volume is enabled by default. If you specify the syncing=no attribute to vxsnap make, this disables synchronization, and the contents of the instant snapshot are unlikely ever to become fully synchronized with the contents of the original volume at the point in time that the snapshot was taken. If you wish to move an instant snapshot volume to another disk group for export to another machine for off-host processing, or to turn it into an independent volume, you must ensure that the snapshot volume has been completely synchronized.

You can immediately retake a full-sized or space-optimized instant snapshot at any time by using the vxsnap refresh command. If a fully synchronized instant snapshot is required, you must wait for the new resynchronization to complete.

You can create instant snapshots of volume sets by replacing volume names with volume set names in the vxsnap command. For more information, see Creating Instant Snapshots of Volume Sets.

To back up a volume with the vxsnap command, use the following procedure:

  1. If you intend to take a space-optimized instant snapshot of the volume, you may wish to consider first setting up a shared cache object in the same disk group as the volume. This cache object can be maintained by using the vxcache command.

    See Creating a Shared Cache Object for details of how to set up a shared cache object.


    Note   Note    If you intend to split the volume and snapshot into separate disk groups (for example, to perform off-host processing), you must use a fully synchronized full-sized instant snapshot (which does not require a cache object). You cannot use a space-optimized instant snapshot for this purpose.
  2. Use the following commands on the primary host to see if the volume is associated with a version 20 data change object (DCO) and DCO volume that allow instant snapshots and Persistent FastResync to be used with the volume, and to check that FastResync is enabled on the volume:
    vxprint -g volumedg -F%instant volume
    vxprint -g volumedg -F%fastresync volume

    If both these command return a value of on, the volume can be used for instant snapshot operations.

    To prepare a volume for instant snapshots, use the following command:


    vxsnap [-g diskgroup] prepare volume [regionsize=size] \ 
      [ndcomirs=number] [alloc=storage_attributes]
    Note   Note    It is only necessary to run the vxsnap prepare command on a volume if it does not already have a version 20 DCO volume (for example, if you have run the vxsnap unprepare command on the volume). See Creating a Volume with a Version 20 DCO Volume, Preparing a Volume for DRL and Instant Snapshots and Removing Support for DRL and Instant Snapshots from a Volume for more information.

    For example, to prepare the volume, myvol, in the disk group, mydg, use the following command:


    vxsnap -g mydg prepare myvol regionsize=128k ndcomirs=2 \
      alloc=mydg10,mydg11

    This example creates a DCO object and redundant DCO volume with two plexes located on disks mydg10 and mydg11, and associates them with myvol. The region size is also increased to 128KB from the default size of 64KB. 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.

    For space-optimized instant snapshots that share a cache object, the specified region size must be greater than or equal to the region size specified for the cache object. See Creating a Shared Cache Object for details.


    Note   Note    Creation of space-optimized snapshots that use a shared cache fails if the region size specified for the volume is smaller than the region size set on the cache.

    If the region size of a space-optimized snapshot differs from the region size of the cache, this can degrade the system's performance compared to the case where the region sizes are the same.

    When using the vxsnap prepare or vxassist make commands to make a volume ready for instant snapshot operations, if the specified region size exceeds half the value of the tunable voliomem_maxpool_sz (see voliomem_maxpool_sz), the operation succeeds but gives a warning such as the following (for a system where voliomem_maxpool_sz is set to 12MB):


    VxVM vxassist WARNING V-5-1-0 Specified regionsize is larger than the limit on the system (voliomem_maxpool_sz/2=6144k).

    vxsnap make operations to create full-sized or space-optimized instant snapshots, and refresh and restore operations on such volumes fail as they might potentially hang the system. Such volumes can be used only for breakoff-type snapshot operations using the reattach and make operations.

    To make the volumes usable for instant snapshot operations, use vxsnap unprepare on the volume, and then use vxsnap prepare to re-prepare the volume with a region size that is less than half the size of voliomem_maxpool_sz (in this example, 1MB):


    vxsnap -g mydg -f unprepare vol1
    vxsnap -g mydg prepare vol1 regionsize=1M
  3. For full-sized instant snapshots, you must create a volume that is to be used as the snapshot volume. This must be the same size as the volume for which the snapshot is being created, and it must also have the same region size. See Creating a Volume for Use as a Full-Sized Instant Snapshot for details.

    Alternatively, if there is a sufficient number of suitable plexes available in the volume, you can break these off and use them to create a full-sized instant snapshot. You can either use existing ACTIVE plexes in the volume, or you can use the following command to add new snapshot mirrors to the volume:


    vxsnap [-b] [-g diskgroup] addmir volume [nmirror=N] \
      [alloc=storage_attributes]

    By default, the vxsnap addmir command adds one snapshot mirror to a volume unless you use the nmirror attribute to specify a different number of mirrors. The mirrors remain in the SNAPATT state until they are fully synchronized. The -b option can be used to perform the synchronization in the background. Once synchronized, the mirrors are placed in the SNAPDONE state.

    For example, the following command adds 2 mirrors to the volume, vol1, on disks mydg10 and mydg11:


    vxsnap -g mydg addmir vol1 nmirror=2 alloc=mydg10,mydg11
    Note   Note    To turn one or more existing plexes in a volume into a break-off instant snapshot volume, the volume must be a non-layered volume with a mirror or mirror-stripe layout, or a RAID-5 volume that you have converted to a special layered volume (see Using a DCO and DCO Volume with a RAID-5 Volume) and then mirrored. The plexes in a volume with a stripe-mirror layout are mirrored at the sub-volume level, and cannot be broken off.
  4. Use the vxsnap make step to create an instant snapshot that is immediately available for making a backup. If you specify a name and size for a storage cache, a space-optimized snapshot is created that requires less space than does a full-sized snapshot volume.

    Depending on the type of instant snapshot that you require, there are three main variants on the vxsnap make command that you can issue:

  • To create a full-sized instant snapshot, use one of the following forms of the vxsnap make command:

  • vxsnap [-g diskgroup] make source=volume/snapvol=snapvol\
      [/syncing=off]
    vxsnap [-g diskgroup] make source=volume[/newvol=snapvol]\
      {/plex=plex1[,plex2,...]|/nmirror=number]}
    Note   Note    The attributes for a snapshot are specified as a tuple. The vxsnap make command accepts multiple tuples; one for each snapshot that is being created. A tuple for a full-sized instant snapshot must contain a source attribute and a snapvol attribute. Each element of a tuple is separated from the next by a slash character (/). Tuples are separated by white space.
    The first form of the command specifies an existing volume, snapvol, that is to be used as the snapshot volume. See Creating a Volume for Use as a Full-Sized Instant Snapshot for details.
    For example, to use the prepared volume, snap1myvol, as the snapshot for the volume, myvol, in the disk group, mydg, use the following command:

    vxsnap -g mydg make source=myvol/snapvol=snap1myvol
    For full-size instant snapshots that are created from an empty volume, background synchronization is enabled by default (equivalent to specifying the syncing=on attribute). If you want to move a snapshot into a separate disk group, or to turn it into an independent volume, you must wait for its contents to be synchronized with those of its parent volume.
    You can use the vxsnap syncwait command to wait for the synchronization of the snapshot volume to be completed, as shown here:

    vxsnap [-g diskgroup] syncwait snapvol 
    For example, you would use the following command to wait for synchronization to finish on the snapshot volume, snap2myvol:

    vxsnap -g mydg syncwait snap2myvol
    This command exits (with a return code of zero) when synchronization of the snapshot volume is complete. The snapshot volume may then be moved to another disk group or turned into an independent volume.
    If required, you can use the following command to verify whether the V_PFLAG_INCOMPLETE flag is set on a volume:

    vxprint [-g diskgroup] -F%incomplete snapvol
    This command returns the value off if synchronization of the volume, snapvol, is complete; otherwise, it returns the value on.
    You can also use the vxsnap print command to check on the progress of synchronization as described in Displaying Instant Snapshot Information (vxsnap print).
    See Controlling Instant Snapshot Synchronization for more information.
    If you do not want to move the snapshot into a separate disk group, or to turn it into an independent volume, specify the syncing=off attribute. This avoids creating unnecessary system overhead. For example, to turn off synchronization when creating the snapshot of the volume, myvol, you would use the following form of the vxsnap make command:

    vxsnap -g mydg make source=myvol/snapvol=snap1myvol/syncing=off
    The second form of the vxsnap make command uses one of the following attributes to create the new snapshot volume, snapvol, by breaking off one or more existing plexes in the original volume:
    plex Specifies the plexes in the existing volume that are to be broken off. This attribute can only be used with plexes that are in the ACTIVE state.
    nmirror Specifies how many plexes are to be broken off. This attribute can only be used with plexes that are in the SNAPDONE state. (That is, they have been added to the volume by using the vxsnap addmir command.)
    Snapshots that are created from one or more ACTIVE or SNAPDONE plexes in the volume are already synchronized by definition.
    For backup purposes, a snapshot volume with one plex should be sufficient.

    Note   Note    Break-off snapshots are suitable for write-intensive volumes (such as for database redo logs) where the copy-on-write mechanism of space-optimized or full-sized instant snapshots might degrade the performance of the volume.

    Snapshots that you create by using vxsnap to detach existing plexes in the volume are functionally equivalent to the traditional third-mirror break-off snapshots that you can create by using vxassist. As future releases may not support this functionality in vxassist, it is recommended that you use vxsnap to create this type of snapshot.

    For example, to create the instant snapshot volume, snap2myvol, of the volume, myvol, in the disk group, mydg, from a single existing plex in the volume, use the following command:

    vxsnap -g mydg make source=myvol/newvol=snap2myvol/nmirror=1
    The next example shows how to create a mirrored snapshot from two existing plexes in the volume:

    # vxsnap -g mydg make source=myvol/newvol=snap2myvol\
    /plex=myvol-03,myvol-04
  • To create a space-optimized instant snapshot, snapvol, that uses a named shared cache object:

  • vxsnap [-g diskgroup] make source=vol/newvol=snapvol\
    /[cache=cacheobject] [alloc=storage_attributes]
    For example, to create the space-optimized instant snapshot, snap3myvol, of the volume, myvol, in the disk group, mydg, on the disk mydg14, and which uses the shared cache object, cobjmydg, use the following command:

    vxsnap -g mydg make source=myvol/newvol=snap3myvol\
    /cache=cobjmydg alloc=mydg14
    For details of how to create a shared cache object, see Creating a Shared Cache Object.
  • To create a space-optimized instant snapshot, snapvol, and also create a cache object for it to use:

  • vxsnap [-g diskgroup] make source=vol/newvol=snapvol\
    [/cachesize=size][/autogrow=yes][/ncachemirror=number]\
      [alloc=storage_attributes]
    The cachesize attribute determines the size of the cache relative to the size of the volume. The autogrow attribute determines whether VxVM will automatically enlarge the cache if it is in danger of overflowing. By default, the cache is not grown.

    Note   Note    If autogrow is enabled, but the cache cannot be grown, VxVM disables the oldest and largest snapshot that is using the same cache, and releases its cache space for use.
    The ncachemirror attribute specifies the number of mirrors to create in the cache volume. For backup purposes, the default value of 1 should be sufficient.
    For example, to create the space-optimized instant snapshot, snap4myvol, of the volume, myvol, in the disk group, mydg, on the disk mydg15, and which uses a newly allocated cache object that is 1GB in size, but which can automatically grow in size, use the following command:

    vxsnap -g mydg make source=myvol/new=snap4myvol/cachesize=1g\
    /autogrow=yes alloc=mydg15
    Note   Note    If a cache is created implicitly by specifying cachesize, and ncachemirror is specified to be greater than 1, a DCO is attached to the cache volume to enable dirty region logging (DRL). DRL allows fast recovery of the cache backing store after a system crash. The DCO is allocated on the same disks as those that are occupied by the DCO of the source volume. This is done to allow the cache and the source volume to remain in the same disk group for disk group move, split and join operations.

  1. Use fsck (or some utility appropriate for the application running on the volume) to clean the temporary volume's contents. For example, you can use this command with a VxFS file system:
    fsck -F vxfs /dev/vx/rdsk/diskgroup/snapshot
  2. If you require a backup of the data in the snapshot, use an appropriate utility or operating system command to copy the contents of the snapshot to tape, or to some other backup medium.

You have the following choices of what to do with an instant snapshot:

  • Refresh the contents of the snapshot. This creates a new point-in-time image of the original volume ready for another backup. If synchronization was already in progress on the snapshot, this operation may result in large portions of the snapshot having to be resynchronized. See Refreshing an Instant Snapshot (vxsnap refresh) for details.
  • Reattach some or all of the plexes of the snapshot volume with the original volume. See Reattaching an Instant Snapshot (vxsnap reattach) for details.

  • Note   Note    The reattach operation is not supported for space-optimized instant snapshots.
  • Restore the contents of the original volume from the snapshot volume. For full-sized instant snapshots, you can choose whether none, a subset, or all of the plexes of the snapshot volume are returned to the original volume as a result of the operation. A space-optimized instant snapshot always remains intact at the end of the operation. See Restoring a Volume from an Instant Snapshot (vxsnap restore) for details.
  • Dissociate the snapshot volume entirely from the original volume. This may be useful if you want to use the copy for other purposes such as testing or report generation. If desired, you can delete the dissociated volume. See Dissociating an Instant Snapshot (vxsnap dis) for details.

  • Note   Note    For space-optimized instant snapshots, this operation is only useful if you then want to delete the snapshot altogether.
  • If the snapshot is part of a snapshot hierarchy, you can also choose to split this hierarchy from its parent volumes. See Splitting an Instant Snapshot Hierarchy (vxsnap split) for details.

  • Note   Note    This operation is not supported for space-optimized instant snapshots.

Creating Multiple Instant Snapshots

To make it easier to create snapshots of several volumes at the same time, the vxsnap make command accepts multiple tuples that define the source and snapshot volumes names as their arguments. For example, to create three instant snapshots, each with the same redundancy, from specified storage, the following form of the command can be used:


vxsnap [-g diskgroup] make source=vol1/snapvol=snapvol1\
  source=vol2/snapvol=snapvol2 source=vol3/snapvol=snapvol3

The snapshot volumes (snapvol1, snapvol2 and so on) must have been prepared in advance as described in Creating a Volume for Use as a Full-Sized Instant Snapshot. The specified source volumes (vol1, vol2 and so on) may be the same volume or they can be different volumes.

If all the snapshots are to be space-optimized and to share the same cache, the following form of the command can be used:


# vxsnap [-g diskgroup] make \
source=
vol1/newvol=snapvol1/cache=cacheobj \
source=
vol2/newvol=snapvol2/cache=cacheobj \
source=
vol3/newvol=snapvol3/cache=cacheobj \
[alloc=
storage_attributes]

The vxsnap make command also allows the snapshots to be of different types, have different redundancy, and be configured from different storage, as shown here:


# vxsnap [-g diskgroup] make source=vol1/snapvol=snapvol1 \
source=
vol2[/newvol=snapvol2]/cache=cacheobj\
[/alloc=
storage_attributes2][/nmirror=number2]
source=
vol3[/newvol=snapvol3][/alloc=storage_attributes3]\
/nmirror=
number3

In this example, snapvol1 is a full-sized snapshot that uses a prepared volume, snapvol2 is a space-optimized snapshot that uses a prepared cache, and snapvol3 is a break-off full-sized snapshot that is formed from plexes of the original volume.

An example of where you might want to create mixed types of snapshots at the same time is when taking snapshots of volumes containing database redo logs and database tables:


# vxsnap -g mydg make \
source=logv1/newvol=snplogv1/drl=sequential/nmirror=1 \
source=logv2/newvol=snplogv2/drl=sequential/nmirror=1 \
source=datav1/newvol=snpdatav1/cache=mydgcobj/drl=on \

  source=datav2/newvol=snpdatav2/cache=mydgcobj/drl=on

In this example, sequential DRL is enabled for the snapshots of the redo log volumes, and normal DRL is applied to the snapshots of the volumes that contain the database tables. The two space-optimized snapshots are configured to share the same cache object in the disk group. Also note that break-off snapshots are used for the redo logs as such volumes are write intensive.

Creating Instant Snapshots of Volume Sets

Volume set names can be used in place of volume names with the following vxsnap operations on instant snapshots: addmir, dis, make, prepare, reattach, refresh, restore, rmmir, split, syncpause, syncresume, syncstart, syncstop, syncwait, and unprepare.

The procedure for creating an instant snapshot of a volume set is the same as that for a standalone volume. However, there are certain restrictions if a full-sized instant snapshot is to be created from a prepared volume set. A full-sized instant snapshot of a volume set must itself be a volume set with the same number of volumes, and the same volume sizes and index numbers as the parent. For example, if a volume set contains three volumes with sizes 1GB, 2GB and 3GB, and indexes 0, 1 and 2 respectively, then the snapshot volume set must have three volumes with the same sizes matched to the same set of index numbers. The corresponding volumes in the parent and snapshot volume sets are also subject to the same restrictions as apply between standalone volumes and their snapshots.

You can use the vxvset list command to verify that the volume sets have identical characteristics as shown in this example:


vxvset -g mydg list vset1
VOLUME         INDEX      LENGTH      KSTATE      CONTEXT
vol_0         0      204800      ENABLED      -
vol_1         1      409600      ENABLED      -
vol_2         2      614400      ENABLED      -

vxvset -g mydg list snapvset1
VOLUME         INDEX      LENGTH      KSTATE      CONTEXT
svol_0         0      204800      ENABLED      -
svol_1         1      409600      ENABLED      -
svol_2         2      614400      ENABLED      -

A full-sized instant snapshot of a volume set can be created using a prepared volume set in which each volume is the same size as the corresponding volume in the parent volume set. Alternatively, you can use the nmirrors attribute to specify the number of plexes that are to be broken off provided that sufficient plexes exist for each volume in the volume set.

The following example shows how to prepare a source volume set, vset1, and an identical volume set, snapvset1, which is then used to create the snapshot:


vxsnap -g mydg prepare vset1
vxsnap -g mydg prepare snapvset1
vxsnap -g mydg make source=vset1/snapvol=snapvset1

To create a full-sized third-mirror break-off snapshot, you must ensure that each volume in the source volume set contains sufficient plexes. The following example shows how to achieve this by using the vxsnap command to add the required number of plexes before breaking off the snapshot:


vxsnap -g mydg prepare vset2
vxsnap -g mydg addmir vset2 nmirror=1
vxsnap -g mydg make source=vset2/newvol=snapvset2/nmirror=1

See Adding Snapshot Mirrors to a Volume for more information about adding plexes to volumes or to volume sets.

To create a space-optimized instant snapshot of a volume set, the commands are again identical to that for a standalone volume as shown in these examples:


vxsnap -g mydg prepare vset3
vxsnap -g mydg make source=vset3/newvol=snapvset3/cachesize=20m

vxsnap -g mydg prepare vset4
vxsnap -g mydg make source=vset4/newvol=snapvset4/cache=mycobj

Here a new cache object is created for the volume set, vset3, and an existing cache object, mycobj, is used for vset4.

See Creating and Administering Volume Sets for more information on creating and administering volume sets.

Adding Snapshot Mirrors to a Volume

If you are going to create a full-sized break-off snapshot volume, you can use the following command to add new snapshot mirrors to a volume:


vxsnap [-b] [-g diskgroup] addmir volume|volume_set [nmirror=N] \
  [alloc=storage_attributes]
Note   Note    The volume must have been prepared using the vxsnap prepare command as described in Preparing a Volume for DRL and Instant Snapshots.

If a volume set name is specified instead of a volume, the specified number of plexes is added to each volume in the volume set.

By default, the vxsnap addmir command adds one snapshot mirror to a volume unless you use the nmirror attribute to specify a different number of mirrors. The mirrors remain in the SNAPATT state until they are fully synchronized. The -b option can be used to perform the synchronization in the background. Once synchronized, the mirrors are placed in the SNAPDONE state.

For example, the following command adds 2 mirrors to the volume, vol1, on disks mydg10 and mydg11:


vxsnap -g mydg addmir vol1 nmirror=2 alloc=mydg10,mydg11
Note   Note    This command is similar in usage to the vxassist snapstart command, and supports the traditional third-mirror break-off snapshot model. As such, it does not provide an instant snapshot capability.

Once you have added one or more snapshot mirrors to a volume, you can use the vxsnap make command with either the nmirror attribute or the plex attribute to create the snapshot volumes.

Removing a Snapshot Mirror from a Volume

To remove a single snapshot mirror from a volume, use this command:


vxsnap [-g diskgroup] rmmir volume|volume_set

For example, the following command removes a snapshot mirror from the volume, vol1:


vxsnap -g mydg rmmir vol1
Note   Note    This command is similar in usage to the vxassist snapabort command.

If a volume set name is specified instead of a volume, a mirror is removed from each volume in the volume set.

Adding a Snapshot to a Cascaded Snapshot Hierarchy

To create a snapshot and push it onto a snapshot hierarchy between the original volume and an existing snapshot volume, specify the name of the existing snapshot volume as the value of the infrontof attribute to the vxsnap make command. The following example shows how to place the space-optimized snapshot, thurs_bu, of the volume, dbvol, in front of the earlier snapshot, wed_bu:


vxsnap -g dbdg make source=dbvol/newvol=thurs_bu/\
infrontof=wed_bu/cache=dbdgcache

Similarly, the next snapshot that is taken, fri_bu, is placed in front of thurs_bu:


vxsnap -g dbdg make source=dbvol/newvol=fri_bu/\
infrontof=thurs_bu/cache=dbdgcache

For more information on the application of cascaded snapshots, see Cascaded Snapshots.

Refreshing an Instant Snapshot (vxsnap refresh)

Refreshing an instant snapshot replaces it with another point-in-time copy of a parent volume. To refresh one or more snapshots and make them immediately available for use, use the following command:


# vxsnap [-g diskgroup] refresh snapvolume|snapvolume_set \
source=
volume|volume_set [[snapvol2 source=vol2]...] \
[syncing=yes|no]

If the source volume is not specified, the immediate parent of the snapshot is used. For full-sized instant snapshots, resynchronization is started by default. To disable resynchronization, specify the syncing=no attribute. This attribute is not supported for space-optimized snapshots.


Note   Note    The snapshot being refreshed must not be open to any application. For example, any file system configured on the volume must first be unmounted.

It is possible to refresh a volume from an unrelated volume provided that their sizes are compatible.

You can use the vxsnap syncwait command to wait for the synchronization of the snapshot volume to be completed, as shown here:


vxsnap [-g diskgroup] syncwait snapvol

See Controlling Instant Snapshot Synchronization for more information.

Reattaching an Instant Snapshot (vxsnap reattach)


Note   Note    This operation is not supported for space-optimized instant snapshots.

Using the following command, some or all plexes of an instant snapshot may be reattached to the specified original volume, or to a source volume in the snapshot hierarchy above the snapshot volume:


# vxsnap [-g diskgroup] reattach snapvolume|snapvolume_set \
source=
volume|volume_set [nmirror=number]

By default, all the plexes are reattached, which results in the removal of the snapshot. If required, the number of plexes to be reattached may be specified as the value assigned to the nmirror attribute.


Note   Note    The snapshot being reattached must not be open to any application. For example, any file system configured on the snapshot volume must first be unmounted.

It is possible to reattach a volume to an unrelated volume provided that their sizes are compatible.

You cannot use the vxsnap syncwait command to wait for synchronization of the reattached plexes to complete.

For example the following command reattaches one plex from the snapshot volume, snapmyvol, to the volume, myvol:


vxsnap -g mydg reattach snapmyvol source=myvol nmirror=1

While the reattached plexes are being resynchronized from the data in the parent volume, they remain in the SNAPTMP state. After resynchronization is complete, the plexes are placed in the ACTIVE state.


Note   Note    If the volume and its snapshot have both been resized (to an identical smaller or larger size) before performing the reattachment, a fast resynchronization can still be performed. A full resynchronization is not required. Version 20 DCO volumes are resized proportionately when the associated data volume is resized. For version 0 DCO volumes, the FastResync maps stay the same size, but the region size is recalculated, and the locations of the dirty bits in the existing maps are adjusted. In both cases, new regions are marked as dirty in the maps.

Restoring a Volume from an Instant Snapshot (vxsnap restore)

It may sometimes be desirable to reinstate the contents of a volume from a backup or modified replica in a snapshot volume. The following command may be used to restore one or more volumes from the specified snapshots:


# vxsnap [-g diskgroup] restore volume|volume_set \
source=
snapvolume|snapvolume_set \
[[
volume2|volume_set2 source=snapvolume2|snapvolume_set2]...] \
[destroy=yes|no] [syncing=yes|no] [nmirror=
number]

For a full-sized instant snapshot, some or all of its plexes may be reattached to the parent volume or to a specified source volume in the snapshot hierarchy above the snapshot volume. If destroy=yes is specified, all the plexes of the full-sized instant snapshot are reattached and the snapshot volume is removed.

For a space-optimized instant snapshot, the cached data is used to recreate the contents of the specified volume. The space-optimized instant snapshot remains unchanged by the restore operation.


Note   Note    For this operation to succeed, the volume that is being restored and the snapshot volume must not be open to any application. For example, any file systems that are configured on either volume must first be unmounted.

It is not possible to restore a volume from an unrelated volume.

The destroy and nmirror attributes are not supported for space-optimized instant snapshots.

The following example demonstrates how to restore the volume, myvol, from the space-optimized snapshot, snap3myvol.


vxsnap -g mydg restore myvol source=snap3myvol

Dissociating an Instant Snapshot (vxsnap dis)

The following command breaks the association between a full-sized instant snapshot volume, snapvol, and its parent volume, so that the snapshot may be used as an independent volume:


vxsnap [-f] [-g diskgroup] dis snapvolume|snapvolume_set

This operation fails if the snapshot, snapvol, has a snapshot hierarchy below it that contains unsynchronized snapshots. If this happens, the dependent snapshots must be fully synchronized from snapvol. When no dependent snapshots remain, snapvol may be dissociated. The snapshot hierarchy is then adopted by snapvol's parent volume.


Note   Note    To be usable after dissociation, the snapshot volume and any snapshots in the hierarchy must have been fully synchronized. See Controlling Instant Snapshot Synchronization for more information. In addition, you cannot dissociate a snapshot if synchronization of any of the dependent snapshots in the hierarchy is incomplete. If an incomplete snapshot is dissociated, it is unusable and should be deleted as described in Removing an Instant Snapshot.

The following command dissociates the snapshot, snap2myvol, from its parent volume:


vxsnap -g mydg dis snap2myvol
Note   Note    When applied to a volume set or to a component volume of a volume set, this operation can result in inconsistencies in the snapshot hierarchy in the case of a system crash or hardware failure. If the operation is applied to a volume set, the -f (force) option must be specified.

Removing an Instant Snapshot

When you have dissociated a full-sized instant snapshot, you can use the vxedit command to delete it altogether, as shown in this example:


vxedit -g mydg -r rm snap2myvol

You can also use this command to remove a space-optimized instant snapshot from its cache. For details of how to remove a cache, see Removing a Cache.

Splitting an Instant Snapshot Hierarchy (vxsnap split)


Note   Note    This operation is not supported for space-optimized instant snapshots.

The following command breaks the association between a snapshot hierarchy that has the snapshot volume, snapvol, at its head, and its parent volume, so that the snapshot hierarchy may be used independently of the parent volume:


vxsnap [-f] [-g diskgroup] split snapvolume|snapvolume_set
Note   Note    The topmost snapshot volume in the hierarchy must have been fully synchronized for this command to succeed. Snapshots that are lower down in the hierarchy need not have been fully resynchronized. See Controlling Instant Snapshot Synchronization for more information.

The following command splits the snapshot hierarchy under snap2myvol from its parent volume:


vxsnap -g mydg split snap2myvol
Note   Note    When applied to a volume set or to a component volume of a volume set, this operation can result in inconsistencies in the snapshot hierarchy in the case of a system crash or hardware failure. If the operation is applied to a volume set, the -f (force) option must be specified.

Displaying Instant Snapshot Information (vxsnap print)

The vxsnap print command may be used to display information about the snapshots that are associated with a volume.


vxsnap [-g diskgroup] print [vol]

This command shows the percentage progress of the synchronization of a snapshot or volume. If no volume is specified, information about the snapshots for all the volumes in a disk group is displayed. The following example shows a volume, vol1, which has a full-sized snapshot, snapvol1 whose contents have not been synchronized with vol1:


vxsnap -g mydg print
NAME      SNAPOBJECT         TYPE     PARENT        SNAPSHOT       %DIRTY      %VALID

vol1      --         volume     --       --       --      100
      snapvol1_snp1         volume     --       snapvol1       1.30      --
snapvol1      vol1_snp1         volume     vol1       --       1.30      1.30

The %DIRTY value for snapvol1 shows that its contents have changed by 1.30% when compared with the contents of vol1. As snapvol1 has not been synchronized with vol1, the %VALID value is the same as the %DIRTY value. If the snapshot were partly synchronized, the %VALID value would lie between the %DIRTY value and 100%. If the snapshot were fully synchronized, the %VALID value would be 100%. The snapshot could then be made independent or moved into another disk group.

Controlling Instant Snapshot Synchronization


Note   Note    Synchronization of the contents of a snapshot with its original volume is not possible for space-optimized instant snapshots.

By default, synchronization is enabled for the vxsnap reattach, refresh and restore operations on instant snapshots. Otherwise, synchronization is disabled unless you specify the syncing=yes attribute to the vxsnap command.

The following table shows the commands that are provided for controlling the synchronization manually.

Command Description

vxsnap [-g diskgroup] syncpause vol|vol_set

Pause synchronization of a volume.

vxsnap [-g diskgroup] syncresume \
vol|vol_set

Resume synchronization of a volume.

vxsnap [-b] [-g diskgroup] syncstart \
vol|vol_set

Start synchronization of a volume. The -b option puts the operation in the background.

vxsnap [-g diskgroup] syncstop vol|vol_set

Stop synchronization of a volume.

vxsnap [-g diskgroup] syncwait vol|vol_set

Exit when synchronization of a volume is complete. An error is returned if vol is invalid (for example, it is a space-optimized snapshot), or if vol is not being synchronized.



Note    You cannot use this command to wait for synchronization of reattached plexes to complete.

Improving the Performance of Snapshot Synchronization

Two optional arguments to the -o option are provided to help optimize the performance of synchronization when using the make, refresh, restore and syncstart operations:

iosize=size Specifies the size of each I/O request that is used when synchronizing the regions of a volume. Specifying a larger size causes synchronization to complete sooner, but with greater impact on the performance of other processes that are accessing the volume. The default size of 1m (1MB) is suggested as the minimum value for high-performance array and controller hardware. The specified value is rounded to a multiple of the volume's region size.

slow=iodelay Specifies the delay in milliseconds between synchronizing successive sets of regions as specified by the value of iosize. This can be used to change the impact of synchronization on system performance. The default value of iodelay is 0 milliseconds (no delay). Increasing this value slows down synchronization, and reduces the competition for I/O bandwidth with other processes that may be accessing the volume.

Options may be combined as shown in the following examples:


# vxsnap -g mydg -o iosize=2m,slow=100 make \
source=myvol/snapvol=snap2myvol/syncing=on

# vxsnap -g mydg -o iosize=10m,slow=250 syncstart snap2myvol
Note   Note    These optional parameters only affect the synchronization of full-sized instant snapshots. They are not supported for space-optimized snapshots.
 ^ Return to Top Previous  |  Next  >  
Product: Volume Manager Guides  
Manual: Volume Manager 4.1 Administrator's Guide  
VERITAS Software Corporation
www.veritas.com