Solaris Transition Guide

Backing Up and Restoring Files

This section discusses the changes to backup and restore commands and SunOS release 5.7 and describes how to use the ufsdump, ufsrestore, dd, tar, and cpio commands.

The SunOS release 4 software supported several utilities for backing up and restoring files: dump, restore, tar, cpio, dd, and bar, as well as the unbundled Backup CoPilot program. This release supports all of these utilities except bar and Backup Copilot. SunOS release 4 bar files can be restored on a SunOS release 5.7 system but you cannot create new bar files. The dump(8) and restore(8) commands were renamed ufsdump(1M) and ufsrestore(1M). Files created with the SunOS release 4 dump command can be restored on a SunOS release 5.7 system with ufsrestore.

The SunOS release 5.7 software has two additional utilities for copying file systems: volcopy(1M) and labelit(1M).

ufsdump Command

The ufsdump command accepts the same command syntax as the SunOS release 4 dump command. ufsdump also accepts options listed in Table 9-15.

Table 9-15 ufsdump Command Options Not Available With the dump Command




Autoload. When reaching the end of a tape (before completing the dump), take the drive offline and wait up to two minutes for the tape drive to be ready again. This gives autoloading (stackloader) tape drives a chance to load a new tape. If the drive is ready within two minutes, continue. If it is not ready after two minutes, prompt an operator to load another tape and wait. 


Offline. After completing the dump or reaching the end of a tape or diskette, take the drive offline and rewind the tape or eject the diskette. This prevents another process from using the drive and overwriting your data. 


Estimate size of dump. Determine the amount of space that is needed to perform the dump and output a single number indicating the estimated size of the dump in bytes. This is most useful for incremental backups. 

Unlike dump, ufsdump can detect the end of medium, so you no longer have to use the -s size option to force dump programs to move to the next tape before reaching the end. Nevertheless, to ensure compatibility with older versions of the restore command, the -s option has been retained in ufsdump.

Even though ufsdump now can detect the end of medium, it has no way to predict the number of diskettes or tapes needed for a dump--unless you specify the medium size with the -s option. Therefore, the messages displayed at the start of a backup do not indicate the number of diskettes or tapes required unless you have specified the medium size.

The -w and -W options behave a little differently in the SunOS release 5.7 software. In the SunOS release 4 software, these options list all file systems that are scheduled for backup according to the backup frequencies specified in the /etc/fstab file. Since the SunOS release 5.7 equivalent file, /etc/vfstab, has no provision for specifying backup frequencies, these options now assume that each file system will be backed up daily. Therefore, they now list any file systems that have not been backed up within a day.

When performing backups across the network (backing up local file systems to a remote tape drive), use the device naming convention that is appropriate for the system with the tape drive. If the system with the tape drive is a SunOS release 5.7 system, use the device naming convention to identify the tape drive; otherwise, use the SunOS release 4 convention.

ufsrestore Command

The ufsrestore command in the SunOS release 5.7 software is similar to the restore command in the SunOS release 4 software. You will be able to restore backups made with the SunOS release 4 dump command with one exception: you cannot restore multivolume backups from diskette. If you have backup scripts that invoke restore, change them to invoke ufsrestore instead.

dd Command

In the SunOS release 4 version of the dd command, the size suffix -w (words) denotes a size unit of 4 bytes. In the SunOS release 5.7 version, -w denotes a unit of 2 bytes. In addition, the SunOS release 5.7 version now supports the -unblock and -block conversion options.

tar and cpio Commands

Because they use a nonbinary format, the tar and cpio commands are the only utilities to successfully interchange data between SVR4 implementations. Other backup utilities, such as ufsdump and dd, are unique to the vendor and are not guaranteed to work successfully from one SVR4 implementation to another.

The tar command is unchanged in this release; it accepts the same options and command syntax as the SunOS release 4 command. However, since the device naming scheme has changed in the SunOS release 5.7 software, the tarfile (or device) argument is affected. When using the -f function modifier, specify the device argument as /dev/rmt/unit, where unit is a tape drive number and density. Table 9-16 shows the tape drive density characters in tape device names.

Table 9-16 Tape Drive Density Characters in Tape Device Names




Default "preferred" (highest) density 






The tar command no longer uses /dev/rmt8 as its default output device. When the -f modifier is not used and the TAPE environment variable is not set, the tar command uses the defaults set in the /etc/default/tar file.

The SunOS release 5.7 cpio command supports the SunOS release 4 options and command syntax. cpio has been expanded to include many new options, as listed in Table 9-17.

Table 9-17 Additional cpio Options


Command Available With Option 



cpio -o

Appends files to an archive. 


cpio -i

Attempts to skip corrupt file headers and I/O errors encountered. This option lets you copy files from a medium that is corrupted or out of sequence. 


cpio -o or cpio -p

Follows symbolic links. 


cpio -i, cpio -o, or cpio -p

Special verbose. Prints a dot for each file read or written. This option assures you that cpio is working, without printing all file names.

-C bufsize

cpio -i or cpio -o

Blocks I/O bufsize bytes to the record, where bufsize is a positive integer. When neither -C nor -B is specified, the default buffer size is 512 bytes.

-E filename

cpio -i

Specifies and inputs file containing a list of file names to be extracted from the archive. 

-H header

cpio -i or cpio -o

Reads or writes header information in header format. header can be one of:

bar (read only), crc, CRC, odc, tar, TAR, ustar, or USTAR.

-I filename

cpio -i

Reads filename as an input archive.

-M message

cpio -i -I filename or

cpio -o -O filename

Defines a message to use when switching media. 

-O filename

cpio -o

Directs the output to filename.

-R userid

cpio -i or cpio -p

Reassigns ownership and group information for each file to userid.

Note -

cpio requires one of three mutually exclusive options to specify the action to take: -i (copy in), -o (copy out), or -p (pass).