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

Creating Traditional Third-Mirror Break-Off Snapshots

VxVM provides third-mirror break-off snapshot images of volume devices using vxassist and other commands.


Note   Note    It is recommended that you use the instant snapshot mechanism for backup. Support for traditional third-mirror break-off snapshots created using the vxassist command may be removed in a future release. If you are currently using such snapshots, you should consider migrating your backup strategy to use snapshots that have been created using the vxsnap command.

To enhance the efficiency and usability of volume snapshots, turn on FastResync as described in Enabling FastResync on a Volume. If Persistent FastResync is required, you must associate a version 0 DCO with the volume as described in Adding a Version 0 DCO and DCO Volume.

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

The procedure described in this section requires a plex that is large enough to store the complete contents of the volume. For details of a method that uses space-optimized snapshots, see Creating Instant Snapshots.

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

The vxassist snapshot procedure consists of two steps:

  1. Run vxassist snapstart to create a snapshot mirror.
  2. Run vxassist snapshot to create a snapshot volume.

The vxassist snapstart step creates a write-only backup plex which gets attached to and synchronized with the volume. When synchronized with the volume, the backup plex is ready to be used as a snapshot mirror. The end of the update procedure is indicated by the new snapshot mirror changing its state to SNAPDONE. This change can be tracked by the vxassist snapwait task, which waits until at least one of the mirrors changes its state to SNAPDONE. If the attach process fails, the snapshot mirror is removed and its space is released.


Note   Note    If the snapstart procedure is interrupted, the snapshot mirror is automatically removed when the volume is started.

Once the snapshot mirror is synchronized, it continues being updated until it is detached. You can then select a convenient time at which to create a snapshot volume as an image of the existing volume. You can also ask users to refrain from using the system during the brief time required to perform the snapshot (typically less than a minute). The amount of time involved in creating the snapshot mirror is long in contrast to the brief amount of time that it takes to create the snapshot volume.

The online backup procedure is completed by running the vxassist snapshot command on a volume with a SNAPDONE mirror. This task detaches the finished snapshot (which becomes a normal mirror), creates a new normal volume and attaches the snapshot mirror to the snapshot volume. The snapshot then becomes a normal, functioning volume and the state of the snapshot is set to ACTIVE.

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

  1. Create a snapshot mirror for a volume using the following command:
    vxassist [-b] [-g diskgroup] snapstart [nmirror=Nvolume 

    For example, to create a snapshot mirror of a volume called voldef, use the following command:


    vxassist [-g diskgroup] snapstart voldef

    The vxassist snapstart task creates a write-only mirror, which is attached to and synchronized from the volume to be backed up.


    Note   Note    By default, VxVM attempts to avoid placing snapshot mirrors on a disk that already holds any plexes of a data volume. However, this may be impossible if insufficient space is available in the disk group. In this case, VxVM uses any available space on other disks in the disk group. If the snapshot plexes are placed on disks which are used to hold the plexes of other volumes, this may cause problems when you subsequently attempt to move a snapshot volume into another disk group as described in Moving DCO Volumes Between Disk Groups. To override the default storage allocation policy, you can use storage attributes to specify explicitly which disks to use for the snapshot plexes. See Creating a Volume on Specific Disks for more information.

    If you start vxassist snapstart in the background using the -b option, you can use the vxassist snapwait command to wait for the creation of the mirror to complete as shown here:


    vxassist [-g diskgroup] snapwait volume 

    If vxassist snapstart is not run in the background, it does not exit until the mirror has been synchronized with the volume. The mirror is then ready to be used as a plex of a snapshot volume. While attached to the original volume, its contents continue to be updated until you take the snapshot.

    Use the nmirror attribute to create as many snapshot mirrors as you need for the snapshot volume. For a backup, you should usually only require the default of one.

    It is also possible to make a snapshot plex from an existing plex in a volume. See Converting a Plex into a Snapshot Plex for details.

  2. Choose a suitable time to create a snapshot. If possible, plan to take the snapshot at a time when users are accessing the volume as little as possible.
  3. Create a snapshot volume using the following command:
    vxassist [-g diskgroup] snapshot [nmirror=Nvolume snapshot 

    If required, use the nmirror attribute to specify the number of mirrors in the snapshot volume.

    For example, to create a snapshot of voldef, use the following command:


    vxassist [-g diskgroup] snapshot voldef snapvol

    The vxassist snapshot task detaches the finished snapshot mirror, creates a new volume, and attaches the snapshot mirror to it. This step should only take a few minutes. The snapshot volume, which reflects the original volume at the time of the snapshot, is now available for backing up, while the original volume continues to be available for applications and users.

    If required, you can make snapshot volumes for several volumes in a disk group at the same time. See Creating Multiple Snapshots for more information.

  4. 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
  5. 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.

When the backup is complete, you have the following choices for what to do with the snapshot volume:

  • Reattach some or all of the plexes of the snapshot volume with the original volume as described in Reattaching a Snapshot Volume (vxassist snapback). If FastResync was enabled on the volume before the snapshot was taken, this speeds resynchronization of the snapshot plexes before the backup cycle starts again at step 3.
  • Dissociate the snapshot volume entirely from the original volume as described in Dissociating a Snapshot Volume (vxassist snapclear). This may be useful if you want to use the copy for other purposes such as testing or report generation.
  • Remove the snapshot volume to save space with this command:

  • vxedit [-g diskgroup] -rf rm snapshot
    Note   Note    Dissociating or removing the snapshot volume loses the advantage of fast resynchronization if FastResync was enabled. If there are no further snapshot plexes available, any subsequent snapshots that you take require another complete copy of the original volume to be made.

Converting a Plex into a Snapshot Plex


Note   Note    The procedure described in this section cannot be used with layered volumes or any volume that has an associated version 20 DCO volume.

It is recommended that the instant snapshot feature is used in preference to the procedure described in this section.

In some circumstances, you may find it more convenient to convert an existing plex in a volume into a snapshot plex rather than running vxassist snapstart. For example, you may want to do this if you are short of disk space for creating the snapshot plex and the volume that you want to snapshot contains more than two plexes.

The procedure can also be used to speed up the creation of a snapshot volume when a mirrored volume is created with more than two plexes and init=active is specified.


Note   Note    It is advisable to retain at least two plexes in a volume to maintain data redundancy.

To convert an existing plex into a snapshot plex for a volume on which Persistent FastResync is enabled, use the following command:


vxplex [-g diskgroup] -o dcoplex=dcologplex convert \ 
  state=SNAPDONE plex

dcologplex is the name of an existing DCO plex that is to be associated with the new snapshot plex. You can use the vxprint command to find out the name of the DCO volume as described in Adding a Version 0 DCO and DCO Volume.

For example, to make a snapshot plex from the plex trivol-03 in the 3-plex volume trivol, you would use the following command:


vxplex -o dcoplex=trivol_dcl-03 convert state=SNAPDONE trivol-03

Here the DCO plex trivol_dco_03 is specified as the DCO plex for the new snapshot plex.

To convert an existing plex into a snapshot plex in the SNAPDONE state for a volume on which Non-Persistent FastResync is enabled, use the following command:


vxplex [-g diskgroup] convert state=SNAPDONE plex

A converted plex is in the SNAPDONE state, and can be used immediately to create a snapshot volume.


Note   Note    The last complete regular plex in a volume, an incomplete regular plex, or a dirty region logging (DRL) log plex cannot be converted into a snapshot plex.

Creating Multiple Snapshots

To make it easier to create snapshots of several volumes at the same time, the snapshot option accepts more than one volume name as its argument, for example:


vxassist [-g diskgroup] snapshot volume1 volume2 ...

By default, the first snapshot volume is named SNAP-volume, and each subsequent snapshot is named SNAPnumber-volume, where number is a unique serial number, and volume is the name of the volume for which the snapshot is being taken. This default pattern can be overridden by using the option -o name=pattern, as described on the vxassist(1M) manual page. For example, the pattern SNAP%v-%d reverses the order of the number and volume components in the name.

To snapshot all the volumes in a single disk group, specify the option -o allvols to vxassist:


vxassist -g diskgroup -o allvols snapshot

This operation requires that all snapstart operations are complete on the volumes. It fails if any of the volumes in the disk group do not have a complete snapshot plex in the SNAPDONE state.

Reattaching a Snapshot Volume (vxassist snapback)


Note   Note    The information in this section does not apply to RAID-5 volumes unless they have been converted to a special layered volume layout by the addition of a DCO and DCO volume. See Adding a Version 0 DCO and DCO Volume for details.

Snapback merges a snapshot copy of a volume with the original volume. One or more snapshot plexes are detached from the snapshot volume and re-attached to the original volume. The snapshot volume is removed if all its snapshot plexes are snapped back. This task resynchronizes the data in the volume so that the plexes are consistent.


Note   Note    To enhance the efficiency of the snapback operation, enable FastResync on the volume before taking the snapshot, as described in Enabling FastResync on a Volume.

To merge one snapshot plex with the original volume, use the following command:


vxassist [-g diskgroup] snapback snapshot

where snapshot is the snapshot copy of the volume.

To merge all snapshot plexes in the snapshot volume with the original volume, use the following command:


vxassist [-g diskgroup] -o allplexes snapback snapshot

To merge a specified number of plexes from the snapshot volume with the original volume, use the following command:


vxassist [-g diskgroup] snapback nmirror=number snapshot

Here the nmirror attribute specifies the number of mirrors in the snapshot volume that are to be re-attached.

Once the snapshot plexes have been reattached and their data resynchronized, they are ready to be used in another snapshot operation.

By default, the data in the original volume is used to update the snapshot plexes that have been re-attached. To copy the data from the replica volume instead, use the following command:


vxassist [-g diskgroup] -o resyncfromreplica snapback snapshot
Caution  Caution    Always unmount the snapshot volume (if mounted) before performing a snapback. In addition, you must unmount the file system corresponding to the primary volume before using the resyncfromreplica option.

Adding Plexes to a Snapshot Volume

If you want to retain the existing plexes in a snapshot volume after a snapback operation, create additional snapshot plexes that are to be used for the snapback:

  1. Use the following vxprint commands to discover the names of the snapshot volume's data change object (DCO) and DCO volume:
    DCONAME='vxprint [-g diskgroup] -F%dco_name snapshot'
    DCOVOL='vxprint [-g diskgroup] -F%log_vol $DCONAME'
  2. Use the vxassist mirror command to create mirrors of the existing snapshot volume and its DCO volume:
    vxassist -g diskgroup mirror snapshot
    vxassist -g diskgroup mirror $DCOVOL
    Note   Note    The new plex in the DCO volume is required for use with the new data plex in the snapshot.
  3. Use the vxprint command to find out the name of the additional snapshot plex:
    vxprint -g diskgroup snapshot
  4. Use the vxprint command to find out the record ID of the additional DCO plex:
    vxprint -g diskgroup -F%rid $DCOVOL
  5. Use the vxedit command to set the dco_plex_rid field of the new data plex to the name of the new DCO plex:
    vxedit -g diskgroup set dco_plex_rid=dco_plex_rid new_plex

The new data plex is now ready to be used to perform a snapback operation.

Dissociating a Snapshot Volume (vxassist snapclear)

The link between a snapshot and its original volume can be permanently broken so that the snapshot volume becomes an independent volume. Use the following command to dissociate the snapshot volume, snapshot:


vxassist snapclear snapshot

Displaying Snapshot Information (vxassist snapprint)

The vxassist snapprint command displays the associations between the original volumes and their respective replicas (snapshot copies):


vxassist snapprint [volume] 

Output from this command is shown in the following examples:


vxassist -g mydg snapprint v1
V  NAME         USETYPE      LENGTH
SS SNAPOBJ      NAME         LENGTH     %DIRTY
DP NAME         VOLUME       LENGTH     %DIRTY

v  v1           fsgen        20480
ss SNAP-v1_snp  SNAP-v1      20480      4
dp v1-01        v1           20480      0
dp v1-02        v1           20480      0

v  SNAP-v1      fsgen        20480
ss v1_snp       v1           20480      0
vxassist -g mydg snapprint v2
V  NAME         USETYPE      LENGTH
SS SNAPOBJ      NAME         LENGTH     %DIRTY
DP NAME         VOLUME       LENGTH     %DIRTY

v  v2           fsgen        20480
ss --           SNAP-v2      20480      0
dp v2-01        v2           20480      0

v  SNAP-v2      fsgen        20480
ss --           v2           20480      0

In this example, Persistent FastResync is enabled on volume v1, and Non-Persistent FastResync on volume v2. Lines beginning with v, dp and ss indicate a volume, detached plex and snapshot plex respectively. The %DIRTY field indicates the percentage of a snapshot plex or detached plex that is dirty with respect to the original volume. Notice that no snap objects are associated with volume v2 or with its snapshot volume SNAP-v2. See How Persistent FastResync Works with Snapshots for more information about snap objects.

If a volume is specified, the snapprint command displays an error message if no FastResync maps are enabled for that volume.

 ^ Return to Top Previous  |  Next  >  
Product: Volume Manager Guides  
Manual: Volume Manager 4.1 Administrator's Guide  
VERITAS Software Corporation
www.veritas.com