16.3 Backup and Restore Commands
To do a complete restore of a damaged file system, e.g. /dev/sd0h, you might try:
# newfs /dev/rsd0h - to clear and re-create the file system.
# mount /dev/sd0h /mnt - to mount the file system temporarily.
# cd /mnt - move to the new file system.
# restore -r - restore a level 0 dump of the file system.
Later, incremental dumps can then be restored.
# umount /mnt - unmount the file system.
# fsck /dev/rsd0h - check the file system for consistency.
# mount /dev/sd0h /home - mount the file system
Restore can also be run interactively and you can specify the device, e.g.:
# restore -if /dev/rst9
restore then first recreates the file system in memory so that you can use some UNIX type commands, i.e. ls, cd, and pwd, to move around the file system. You can then "add" entries to a table of files to "extract" from the tape.
A special case is restoration of the root file system. For this you need to boot from tape or CDROM. After restoring the file system you also need to re-install the boot block program, bootblk. This is done with installboot, as in the following for a SCSI disk on SunOS 4.1.X:
# /usr/mdec/installboot /boot bootsd /dev/rsd0a
and for SunOS 5.X:
# /usr/sbin/installboot /usr/platform/'uname -i'/lib/fs/ufs/bootblk /dev/rdsk/c0t3d0s0
As you can see the syntax is dependent on both the hardware platform and software version, so read the man page before using installboot.