4    Backing Up and Restoring

AdvFS provides extended file system backup capabilities with the vdump and vrestore commands. The rvdump and rvrestore commands provide the same capabilities for remote storage devices. In addition, the AdvFS clonefset utility can be used with the vdump command to back up online AdvFS filesets. Clone filesets provide a static snapshot of files for the backup.

The vdump command can be used to back up AdvFS filesets as well as UFS and other standard file systems. This means that you can have a single backup utility for your facility. The dump and restore commands function differently from the vdump and vrestore commands. The dump command works at the inode level so it can handle only UFS files. The vdump command works at the file level. It scans the directories and uses regular POSIX file system calls to access directories and files. See vdump(8) and vrestore(8) for more information.

In the discussion that follows, only the vdump and vrestore commands are mentioned, but the rvdump and rvrestore commands can be substituted for remote operation.

Note

The tools you use to back up and to restore files must be compatible. For example, if you use the vdump or the rvdump command to back up a file system, you must use the vrestore or the rvrestore command to restore saved files. You cannot use the vrestore command to restore files backed up with the dump command.

You do not have to be root user to use the vdump and vrestore commands. However, the AdvFS quota files and the fileset quotas for the fileset can be saved and restored only when the root user initiates the command. You must have write permission for the directory to which you want to restore files.

Do not back up a fileset to an output file in the same fileset.

Note

The vrestore command for operating system versions earlier than Version 4.0 will not properly restore information saved by the vdump command for Version 4.0 or later. The vdump and vrestore dump file formats are compatible in Version 4 and Version 5.

4.1    Backing Up Data

The vdump command creates a list of fixed-size blocks, called a saveset, as it copies all files that are new or have changed after a certain date to the default storage device or the device that you specify. The first block of the saveset contains the block size, the mount point, and other saveset attributes. The vdump command then makes two passes through the directory hierarchy of the file system being backed up. In the first pass it saves the directories and the file names to the second area of the saveset. In the second pass, it writes the file data to the third area of the saveset.

A saveset can span multiple tapes or a tape can contain multiple savesets. Savesets on tapes are delimited by file marks that are written when the saveset is closed by the vdump command.

To enter a vdump command:

vdump options mount_point

For example, to dump the filesets mounted at /psm to tape:

# vdump -0 -f /dev/tape/tape0 /psm

4.1.1    Unique Features of the vdump Command

The vdump command has a number of functions that the UFS dump command does not have. You can:

4.1.2    Dumping to Tape

You can place multiple savesets on one tape with the vdump command. Set the -N option to specify no rewind or specify a no-rewind device such as /dev/ntape/tape0. This ensures that the tape does not rewind when the dump finishes.

If a saveset requires more than one tape to complete, you will be prompted to mount another.

Do not combine the output from the dump and vdump utilities on the same tape. If the vrestore command is used to recover files from a tape created by the dump utility, the results are unpredictable and can result in data loss.

4.1.3    Dumping Subdirectories

You can selectively back up individual subdirectories of a fileset by specifying the subdirectory with the -D option of the vdump command. Without the -D option, if you specify a subdirectory instead of a fileset on the command line, the vdump command backs up the entire fileset that contains the named subdirectory. If you specify the -D option, backup is always run at level 0.

4.1.4    Dumping to Disk Partitions

If you want to dump to a partition that starts at block 0 of a disk, you must first clear the disk label. If you do not, the dump command may appear to contain valid savesets, but when the vrestore command attempts to interpret the disk label as part of the saveset, it will return the message:

vrestore: unable to use save-set; invalid or corrupt format

This is also true for the rvdump and rvrestore commands.

Caution

If you attempt to dump to the first block of a disk partition that contains a valid disk label, the device driver will not overwrite the disk label. You will get an error message only if you are using a character or raw device; block special devices will not return an error.

To correctly dump the first disk block, begin by clearing the disk label with the disklabel command and the -z flag. See vdump(8) and vrestore(8) for more information.

4.1.5    Compressing Savesets

You can compress savesets as they are backed up. This reduces the amount of storage required for the backup and allows the dump to run faster on slow devices because less data is written. Use the -C option with the vdump command to request compression. You cannot specify the compression ratio; it is determined by the contents of the dump.

Note

If you are using a tape drive that automatically does hardware compression, using the vdump command with compression may result in a larger saveset than expected. Sometimes, due to compression algorithms, already compressed data gets expanded when an attempt is made to do more compression.

4.1.6    Dumping with Error Protection

You can use the -x option with the vdump command to place checksum blocks on your tape so that the vrestore command can recover damaged blocks. The vdump command creates these blocks every n number of blocks you specify. The valid range of n is 2 to 32; the default is 8. If the vrestore command detects a read error in a block, it uses the other blocks and the checksum block to recreate the bad block.

Dumping with error protection requires saving one extra block for every n blocks. It can correct only one block in each series of n blocks when the blocks are restored. This means there is a trade-off:

4.1.7    Backup Level

You can specify the level of incremental backup in the vdump command. A value of 0 specifies complete fileset backup. A higher number specifies a less complete backup. See vdump(8) for more information.

The vdump command operates by checking the file modification date. This may cause problems on a subsequent incremental backup because the file modification date does not change if you rename or move a file and don't modify the data. Thus, if you back up your files then move or rename them, change the modification date using the touch command:

touch file_name

4.1.8    Listing Saved Files

You can check your saveset and make sure you have backed up the files you intended. After your backup is complete, run the vrestore command with the -t option to display the files you have saved. This will not initiate the restore procedure.

4.1.9    Dumping and Restoring Files Remotely

The rvdump command backs up files from a single mounted fileset or a clone fileset to a remote storage device. You must be able to execute the rsh command on the remote node to which you are dumping. See rsh(8) for server and client access rules.

The rvdump command has the same options as the vdump command, but you must specify the node name for the device that you are backing your files to. The following example dumps a fileset sar to a tape on node rachem:

# rvdump -0f rachem:/dev/tape/tape0 /sar

To restore the fileset from the remote tape drive, enter:

# rvrestore -xf rachem:/dev/tape/tape0 -D /sar

4.2    Cloning for Online Backup

A clone fileset is a read-only snapshot of the data in an existing fileset. If you have the optional AdvFS Utilities, you can create a clone. You must be the root user to clone the root fileset.

You can create a clone fileset for any AdvFS fileset with the command-line interface (see Section 2.5) or with the AdvFS GUI (see Section 6.4.3). You cannot clone UFS file systems. Only one clone can exist per fileset.

If the files in your system are changing during the time you wish to do your backup, you can create a clone and then back up from the clone because it is stable. Once a clone is created, when you modify the data in your original files, AdvFS saves the data that existed in the original, page by page, into the clone.

Note

After you have finished your backup, delete the clone. Clones of active filesets will continue to grow as the files are changed.

The following example backs up the pssm fileset on line by creating the pssm_clone fileset and backing it up to the default device. The file domain in this example is domain1.

# clonefset domain1 pssm pssm_clone
# mkdir /pssm_clone
# mount -t advfs domain1#pssm_clone /pssm_clone
# vdump -0 -u -C /pssm_clone

To remove the pssm_clone fileset, enter:

# umount /pssm_clone
# rmfset domain1#pssm_clone

4.3    Cloning to Back Up Databases

If your database has an online backup utility, use it to backup the database. If it does not, you can back up databases with database down time limited to the short time it takes to create the clone fileset. Backing up a database with a clone fileset is the same as backing up any other fileset. You get the same benefits (see Section 4.2).

To back up a database with a clone:

  1. Shut down the database so that all database buffers are flushed and the fileset has a complete, consistent copy of the database files.

  2. Clone the fileset and mount the clone.

  3. Reactivate the database.

  4. When you want to back up the clone fileset, run a backup procedure such as the vdump utility or DIGITAL NetWorker.

  5. Unmount and delete the clone.

Caution

Do not use anything except the database's own utilities to back up an active database. You can use the vdump and vrestore commands on a clone fileset that contains the database.

If your database has files spread over multiple AdvFS filesets, it is a good idea to create a clone on each of the filesets at the same time. This ensures a consistent back up of all the database information.

4.4    Restoring Data

The vrestore command restores files by processing the blocks from a saveset created with the vdump command. The vrestore command will not work on a saveset created by the UFS dump command.

You do not have to be root user to run the vrestore command, but you must have write privilege for the directory you will restore to. Only the root user can restore quota files and fileset quotas. See vrestore(8) for details.

4.4.1    Unique Features of the vrestore Command

The vrestore command performs a number of activities that the UFS restore command does not. You can:

4.4.2    Restoring Files

The vrestore command allows you to select specific files and directories to be restored. It can restore data from a file, a pipe, magnetic tapes, or disks.

Use the same version of the vdump and vrestore utilities. If your version of the vrestore utility is unable to read the ormat of your saveset, you will get an error message.

Before you restore files, you can check if the saveset you are accessing contains the information you wish to recover. You can list the names and sizes of all files in the saveset by running the vrestore command using the -t option. The restore operation will not be performed. You can also display the files and directories saved by running the vrestore command with the -i option. This interactive option allows you to select individual files or directories to restore from a list.

Restoring data from a clone fileset is the same as restoring data from any other fileset.

Start with the full backup if you are restoring an entire fileset. Then restore later incremental backups on top of this to retrieve files that have changed since the full backup was created. Files that were deleted after the full backup was performed are restored. It is necessary to delete these files manually.

4.4.3    Restoring Quotas

AdvFS user and group quota files can be restored either to an AdvFS fileset or to a UFS file system. If AdvFS quota files are to be restored to a UFS file system, quotas must be activated on the UFS file system. AdvFS fileset quotas cannot be restored to a UFS file system because there is no UFS analog to AdvFS fileset quotas. You must be root user to restore quotas.

4.4.4    Restoring Selected Savesets

To restore to the current working directory from a tape containing multiple savesets, use the mt command with the fsf n (forward space n savesets or files) option to locate the saveset you want to restore. Then use the vrestore command.

The following example selects and restores the fourth saveset on a tape:

# mt fsf 3
# vrestore -xf /dev/ntape/tape0

The vrestore command can also selectively restore files from your saveset with the -x option followed by the file names. You can specify a destination path other than the current directory for the restored files.

The following example restores the file named data_file from the /mnt/fdump saveset. It is restored to the /mnt directory.

# vrestore -f /mnt/fdump -D /mnt -x data_file
vrestore: Date of the vdump save-set: Tue Jun 15 15:27:36 1999

4.5    AdvFS and NetWorker

NetWorker for Tru64 UNIX provides scheduled, online, automated backup. Use NetWorker with AdvFS as a comprehensive backup solution. NetWorker can automatically back up multiple servers in a heterogeneous environment. It has a graphical interface and several scheduling options.

If filesets will be accessed by users during the backup process, use the AdvFS clonefset utility to clone all filesets for backup and mount the clone filesets. (You can create a script to accomplish this task.) Then, set up NetWorker to automatically back up the clone filesets on a convenient schedule.