Once a snapshot file system is created, it can be used to
perform a consistent backup of the snapped file system. Backup programs
that function using the standard file system tree (such as cpio) can be used without modification on a snapshot
file system, since the snapshot presents the same data as the snapped
file system. Backup programs that access the disk structures of
a VxFS file system need to be snapshot-aware to work correctly with
a snapshot file system. The VxFS utilities understand snapshot file
systems and make suitable modifications in their behavior so that
their operation on a snapshot file system is indistinguishable from
that on a normal file system.
Other backup programs that normally read the raw disk image
cannot work on snapshots without modification. These programs can
use the fscat command to obtain a raw image of the entire file
system identical to that which would have been obtained by a dd of the disk device containing the snapped file
system at the exact moment the snapshot was created. The snapread ioctl takes arguments similar to those of the read system call and returns the same results as would
have been obtained by performing a read on the disk device containing
the snapped file system at the exact time the snapshot was created.
In both cases, however, the snapshot file system provides a consistent
image of the snapped file system with all activity complete; it
is an instantaneous read of the entire file system. This is a marked
contrast to the results that would be obtained by a dd or read of the disk device of an active file system.
If a complete backup of a snapshot file system is made through
a utility such as vxdump and is later restored, it will be necessary to fsck the restored file system because the snapshot
file system is only consistent and not clean. The file system may
have some extended inode operations that must be completed, though
there should be no other changes. Since the snapshot file system
is not writable, it cannot be fully checked. However, the fsck -n command can be used to report any inconsistencies.
Creating a Snapshot File System |
 |
A snapshot file system is created by using the -o snapof= option of the mount command. The -o snapsize= option may also be required if the device being
mounted does not identify the device size in its disk label, or if
a size smaller than the entire device is desired. Use the following syntax
to create a snapshot file system:
mount -F vxfs -o snapof=special|mount_point,snapsize=snapshot_size \ snapshot_special snapshot_mount_point |
The snapshot file system must be created large enough to hold
any blocks on the snapped file system that may be written to while
the snapshot file system exists. If a snapshot file system runs
out of blocks to hold copied data, it will be disabled and all further
access to the snapshot file system will fail.
During a period of low activity when the system is relatively
inactive (for example, on nights and weekends), the snapshot only
needs to contain two to six percent of the blocks of the snapped
file system. During a period of higher activity, the snapshot of
an "average" file system might require 15 percent
of the blocks of the snapped file system, though most file systems
do not experience this much turnover of data over an entire day.
These percentages tend to be lower for larger file systems and higher for
smaller ones. You should manage the blocks allocated to the snapshot based
on such things as file system usage and duration of backups.
 |
 |  |
 |
 | CAUTION: Any existing data on the disk used for the snapshot
is overwritten and lost. |
 |
 |  |
 |
 |
 |  |
 |
 | NOTE: A snapshot file system ceases to exist when unmounted.
If remounted, it will be a fresh snapshot of the snapped file system.
A snapshot file system must be unmounted before the corresponding
snapped file system can be unmounted. If you try to unmount a file
system that has an existing snapshot, umount will fail with a "Device Busy" message, and fuser will not indicate the problem. |
 |
 |  |
 |
Making a Backup |
 |
Here are some typical examples of making a backup of a 300,000
block file system named /home (which exists on disk /dev/dsk/c0t0d0) using a snapshot file system on /dev/dsk/c0t1d0 with a snapshot mount point of /backup/home:
To back up files changed within the
last week using cpio:
# mount -F vxfs -o snapof=/dev/dsk/c0t0d0, \ snapsize=100000 /dev/dsk/c0t1d0 /backup/home # cd /backup # find home -ctime -7 -depth -print | \ cpio -oc > /dev/rmt/0m # umount /backup/home |
To do a full backup of /dev/dsk/c0t0d0 and use dd to control blocking of output onto tape device
using vxdump:
# vxdump f - /dev/rdsk/c0t0d0 | dd bs=128k > /dev/rmt/0m |
To do a level 3 backup of /dev/dsk/c0t0d0 and collect those files that have changed in the
current directory:
# vxdump 3f - /dev/rdsk/c0t0d0 | vxrestore -xf - |
To do a full backup of a snapshot file system:
# mount -o snapof=/dev/dsk/c0t0d0,snapsize=100000 \ /dev/dsk/c0t1d0 /backup/home # vxdump f - /dev/rdsk/c0t1d0 | dd bs=128k > /dev/rmt/0m |
The vxdump utility will ascertain whether /dev/rdsk/c0t1d0 is a snapshot mounted as /backup/home and do the appropriate work to get the snapshot
data through the mount point.