Solaris backup and restore command examples

Many techniques exist for backing up data on Solaris systems. The ufsdump and ufsrestore commands are a powerful choice because they are free, already installed on most Solaris systems, have a wide array of options such as incremental backups, and are fast.

Overview of Solaris utilities

Backup utilities

  • /usr/sbin/ufsdump (sym link to /usr/lib/fs/ufs/ufsdump)
  • /usr/sbin/tar
  • /bin/cpio
  • /bin/dd
  • /usr/ccs/bin/dump

Restore utilities

  • /usr/sbin/ufsrestore (sym link to /usr/lib/fs/ufs/ufsrestore)
  • /usr/sbin/tar
  • /bin/cpio
  • /bin/dd

Tape utilities

  • /bin/mt

Utility summary


  • performs backups of ufs filesystems.
  • performs backups of specified files.
  • able to span multiple tapes.
  • does not cross filesystems.
  • able to perform backups to remote devices


  • able to restore interactively
  • able to restore from remote devices


  • able to cross filesystems.
  • can perform remote dumps and restores with compound commands
  • no interactive mode
  • does not support multiple tapes
  • able to restore singular files
  • able to update dump files.


  • able to cross filesystems
  • supports multiple tapes


  • very simple dump of file/device to another file/device
  • does not support multiple tapes
  • does not cross filesystems

Basic usage


  • this example performs a full backup of c0t0d0s0 and updates the /etc/dumpdates file.
    # ufsdump 0uf /dev/rmt/0cn /dev/rdsk/c0t0d0s0
  • this example performs an incremental backup and updates /etc/dumpdates
    # ufsdump 5uf /dev/rmt/0cn /dev/rdsk/c0t0d0s0
  • this example performs a full dump to a remote device
    hosta# ufsdump 0uf hostb:/dev/rmt/0cn /dev/rdsk/c0t0d0s0

    special notes the remote system must have entries for the local host in the root's .rhosts file. If dumping to a remote file, the remote file must already exist.


  • this example restores to the current directory
    # ufsrestore xf /dev/rmt/0
  • this example will start ufsrestore in interactive mode and restore to the current directory
    # ufsrestore if /dev/rmt/0
  • this example is from the ufsrestore man page. It dumps and restores on one command line.
    # ufsdump 0f - /dev/rdsk/c0t0d0s7 | (cd /home;ufsrestore xf -)
  • this example skips to the 3rd dump on the tape and restores to the current directory
    # ufsrestore sxf 3 /dev/rmt/0


  • this example creates a backup of /usr to tape
    # tar cf /dev/rmt/0cn /usr
  • this example creates a backup of /opt to file
    # tar cf /tmp/opt.tar /opt
  • this example extracts from tape
    # tar xf /dev/rmt/0
  • this example shows the contents of a tar archive from tape
    # tar tvf /dev/rmt/0
  • this example extracts the /etc/passwd and /etc/shadow files from an archive of /etc from tape
    # tar xvf /dev/rmt/0 /etc/shadow /etc/passwd

    special notes tar archives can be created with absolute pathing. The chroot command maybe necessary to unarchive to a different path. GNU tar will automaticly remove leading slashes from paths, so pathing is not a problem.


  • this example creates an archive to tape
    # find . | cpio -ovt > /dev/rmt/0cn
  • this example lists files from from tape
    # cpio -civt < /dev/rmt/0
  • this example extracts files from tape
    # cpio -icv < /dev/rmt/0


  • this example dumps files to tape
    # dd if=/dev/rdsk/c0t0d0s0 of=/dev/rmt/0cn
  • this example extracts files from tape
    # dd if=/dev/rmt/0 of=/dev/rdsk/c0t0d0s0

    special notes Never use dd to send data from one disk to another disk. It will make an exact duplicate of the source disk on the target disk, includeing defect list and vtoc. Ie: you can turn a 9 gig disk into a 1 gig disk and this can not be fixed.


  • this example rewinds a tape
    # mt -f /dev/rmt/0 rew
  • this example rewinds and ejects a tape
    # mt -f /dev/rmt/0 rewoffl
  • this example retensions a tape (occasionally corrects i/o errors)
    # mt -f /dev/rmt/0 retension

Basic Troubleshooting

all utilities

  • i/o error
    • clean the tape drive
    • retension the tape ( mt -f /dev/rmt/? retension)
    • tape is bad
  • ran dump and nothing is on the tape
    • ls -l /dev/rmt* look for any files that are very large and not links (for example ufsdump 0f /dev/rmt0cn or ufsdump 0f /dev/rmt/ocn)


  • accessing remote device fails
    • local host is not /.rhosts on the remote machine.
  • Answering the set owner mode question
    • never answer yes. It will set the owner of all restored files to root.
    • There is no method of keeping this question from being asked.


  • cd /tmp, did tar xvf and no files are there.
    • The archive was done with absolute pathing. Files were restored to their absolute path
  • i cannot tar to /dev/diskette
    • stop /usr/sbin/vold


  • my filesystem was corrupt, did a newfs and restored from dd archive. Corruption is back.
    • dd operates on a block level, corruption was in the archive and put back on the filesystem.

Document Resources


  • How to do a disk-to-disk copy via ufsdump/tar under Solaris 2.X. (InfoDoc 16311)
  • Primary Boot Disk Emergency Backup and Restore. (InfoDoc 20812)
  • Moving filesystems and boot devices with ufsdump and ufsrestore. (InfoDoc 17234)
  • ufsdump aborts with "SIGSEGV( ) ABORTING!". (SRDB 10879)
  • Copying a filesystem using ufsdump w/o a tape drive. (InfoDoc 14067)
  • Central Startup for Remote System Dumps. (InfoDoc 20031)
  • ufsdump remotely not working, cannot connect to tape host. (SRDB 19168)
  • Tape drive parameters in device name. (InfoDoc 14066)
  • A ufsdump/ufsrestore tutorial. (InfoDoc 21351)
  • How can you force tar to restore to a relative path? (InfoDoc 18015)
  • how to back up the root partition using "cpio" command. (SRDB 7031)

Man Pages

  • ufsdump(1M)
  • ufsrestore(1M)
  • tar(1)
    • chroot(1M)
  • cpio(1)
    • ls(1)
    • find(1)
    • dd(1M)
  • mt(1)
    • st(7D)
  • archives(4)