To enhance the efficiency and usability of volume snapshots, turn on FastResync.
If Persistent FastResync is required, you must associate a version 0 DCO with the volume.
A plex is required that is large enough to store the complete contents of the volume. Alternatively, you can use space-optimized instant snapshots.
The recommended approach to performing volume backup from the command line, or from a script, is to use the vxsnap command. The vxassist snapstart, snapwait, and snapshot commands are supported for backward compatibility.
Run vxassist snapstart to create a snapshot mirror.
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.
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 using the vxassist command
# vxassist [-b] [-g diskgroup] snapstart [nmirror=N] volume
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.
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.
To override the default storage allocation policy, you can use storage attributes to specify explicitly which disks to use for the snapshot plexes.
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.
# vxassist [-g diskgroup] snapshot [nmirror=N] volume 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 mydg snapshot voldef snapvoldef
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.
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.
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
This may be useful if you want to use the copy for other purposes such as testing or report generation.
# vxedit [-g diskgroup] -rf rm snapshot