System Administration Guide
Chapter 3, Backing up filesystems

Using the command line to create and restore backups

Using the command line to create and restore backups

You can also perform backup and restore operations using the cpio utility on the command line. The examples included here assume you are using the standard tape device, /dev/rct0. For more information, see cpio(C).

To create a backup:

find . -depth -mount -print | cpio -oHcrcB -C 10240 -K volumesize -O /dev/rct0

where volumesize is the size of the media used. For example, use 120000 for a 120 MB tape drive. The find(C) command is used to create the list of files for the backup. The -mount option prevents backing up mounted filesystems. 

NOTE: Use of the -K option ensures that you are prompted to insert additional media when the current volume is filled. If you are using a large capacity storage device and changing volumes is unnecessary, you can omit the -K option.

To restore a backup:

cpio -iAmudB -I /dev/rct0

Restore individual files or directories by adding them the end of the command line. Remember to use the full pathname and omit the leading /, as in this example:


Use the ``*'' Bourne shell wildcard character to restore a directory, as in this example:


To verify a backup:

cpio -itvn -I /dev/rct0

To list the files on a backup:

cpio -iABmudq -I /dev/rct0 > \*

This command reads the first file off the media. Backups created by the Backup Manager include a file list called _BACKUP_CONTENTS_ at the beginning of each backup. If the backup was created by another means, use this command to list the files:

cpio -itv -I /dev/rct0

See also: