This article hasn't been updated for over 5 years. The information below may be obsolete.

Solaris backup and restore utilities

This article provides an overview of the native backup and restore utilities available within the Solaris operating system.

Overview of utilities

  • Backup Utilities
    • /usr/lib/fs/ufs/ufsdump (linked to /usr/sbin/ufsdump)
    • /usr/sbin/tar
    • /bin/cpio
    • /bin/dd
  • Restore Utilities
    • /usr/lib/fs/ufs/ufsrestore (linked to /usr/sbin/ufsrestore)
    • /usr/sbin/tar
    • /bin/cpio
    • /bin/dd
  • Tape Utility
    • /bin/mt

Utility Summary

  • ufsdump
    • performs backups of ufs filesystems
    • performs backups of specified files
    • able to span multiple tapes
    • does not cross file systems
    • able to perform backups to remove devices
  • ufsrestore
    • able to restore interactively
    • able to restore from remote devices
  • tar
    • 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.
  • cpio
    • able to cross filesystems
    • supports multiple tapes
  • dd
    • very simple dump of file/device to another file/device
    • does not support multiple tapes
    • does not cross filesystems

Basic usage

  • ufsdump
    • 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
    • thisexampleperformsafulldumptoaremotedevice
      # 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.
  • ufsrestore
    • this example restores to the current directory
      # ufsrestore xf /dev/rmt/0
    • thisexamplewillstartufsrestore in interactive mode and restore to the current directory
      # ufsrestore if /dev/rmt/0
    • thisexampleisfromtheufsrestore 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
  • tar
    • 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
  • cpio
    • this example creates an archive to tape
      # find . | cpio -ovt > /dev/rmt/0cn
    • thisexamplelistsfilesfrom from tape
      # cpio -civt < /dev/rmt/0
    • this example extracts files from tape
      # cpio -icv < /dev/rmt/0
  • dd
    • 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
  • mt
    • this example rewinds a tape
      # mt -f /dev/rmt/0 rew
    • this example rewinds and ejects a tape
      # mt -f /dev/rmt/0 rewoffl
    • thisexampleretensions a tape (occasionally corrects i/o errors)
      # mt -f /dev/rmt/0 retension

Documentation Resources

  • Useful man pages:
    • ufsdump(1M)
    • ufsrestore(1M)
    • tar(1)
      • chroot(1M)
    • cpio(1)
      • ls(1)
      • find(1)
    • dd(1M)
    • mt(1)
      • st(7D)
    • archives(4)
  • Useful SunSolve SRDB's and InfoDoc's
      How to do a disk-to-diskcopyviaufsdump/tar under Solaris 2.X. Info Docs: 16311
    • Primary Boot Disk Emergency Backup and Restore. Info Docs: 20812
    • Moving filesystems and boot devices with ufsdump and ufsrestore. Info Docs: 17234
    • ufsdump aborts with "SIGSEGV( ) ABORTING!". Symptoms and Resolutions: 10879
    • Copying a filesystem using ufsdump w/o a tape drive. Info Docs: 14067
    • Central Startup for Remote System Dumps. Info Docs: 20031
    • ufsdump remotely not working, cannot connect to tape host. Symptoms and Resolutions: 19168
    • Tape drive parameters in device name. Info Docs: 14066
    • A ufsdump/ufsrestore tutorial. Info Docs: 21351
    • How can you force tar to restore to a relative path? Info Docs: 18015
    • how to back up the root partition using "cpio" command. Symptoms and Resolutions: 7031

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 example: ufsdump 0f /dev/rmt0cn or ufsdump 0f /dev/rmt/ocn
  • ufsdump/ufsrestore
    • accessingremote 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.
  • tar
    • 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
  • dd
    • 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.

Sample backup scheme

  • Always suggest usingufsdump andufsrestore
    • daily backup scheme to local tape
      • Do full backup on Sunday
      • Do level 5 incremental backups the rest of the week
        • this will reduce restore time in the event of disaster recovery
        • a level 5 everyday will backup all data newer or modified since Sunday's full backup. Therefore restoring several days worth of incrementals is not nessesary.
  • Steps to take
    • gather raw device info.Typicaly from /etc/vfstab. Sometimes customers will have filesystems that aremountedviarc script.
      • via /etc/vfstab
        • grep rdsk /etc/vfstab|grep -v "#"|awk '{print $2}'
      • via mount command
        • mount|grep dsk|awk '{print $1}'
          • ufsdump will translate the mount point to the raw device
    • perform backups via a script or command line with the following basic syntax. It will perform a level 5 backup of each raw fs in /etc/vfstab, update the /etc/dumpdates file, and log the backups to /var/log/mmdddumplog file.
      # for VOL in `grep rdsk /etc/vfstab|grep -v "#"|awk '{print $2}'`
      > do
      > echo "starting dump of $VOL" >> /var/log/`date +%m%d`dumplog
      > ufsdump 5fu /dev/rmt/0cn $VOL >> /var/log/`date +%m%d`dumplog 2>&1
      > echo >> /var/log/`date +%m%d`dumplog
      > done
      # mt rewoffl