Many techniques exist for backing up data on UNIX systems. The ufsdump command is a powerful choice because it is free, already installed on most systems, has a wide array of options such as incremental backups, and is fast. This tech-recipe will describe the simplest use of ufsdump: backing up a single filesystem to a file on disk.
The ufsdump command can be intimidating (particularly if you just read the main page). For simple backups, most options are not relevant. For instance, to back up the /usr filesystem to a file called /data/usr.ufs, use this command:
ufsdump 0f /data/usr.ufs /usr
The 0 (zero) option determines the dump level of the backup. Zero (0) indicates a full backup, while 1-9 are used for incremental backups. The f
The command generates some interesting output during the backup. For example, the output of the command above might look like this:
DUMP: Date of this level 0 dump: Wed 17 May 2006 02:06:11 PM CDT
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c1t0d0s4 (techrx:/usr) to /data/usr.ufs.
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Writing 32 Kilobyte records
DUMP: Estimated 2730660 blocks (1333.33MB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: 2730622 blocks (1333.31MB) on 1 volume at 11356 KB/sec
DUMP: DUMP IS DONE
While this example demonstrates backing up a whole filesystem, it is also possible to backup a subset of a filesystem like a specific directory tree or a single file.