VxVM provides third-mirror break-off snapshot images of volume devices using vxassist
and other commands.
To enhance the efficiency and usability of volume snapshots, turn on FastResync.
See "Enabling FastResync on a volume" on page 301.
If Persistent FastResync is required, you must associate a version 0 DCO with the volume.
See "Adding a version 0 DCO and DCO volume" on page 361.
A plex is required that is large enough to store the complete contents of the volume. Alternatively, you can use space-optimized instant snapshots.
See "Creating and managing space-optimized instant snapshots" on page 330.
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:
vxassist
snapstart
to create a snapshot mirror.
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
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 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.
See "Moving DCO volumes between disk groups" on page 210.
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" on page 253.
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
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.
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:
The specified device must have a valid entry in the /etc/fstab
file.
# vxedit [-g
diskgroup] -rf rm
snapshot
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.