UFS: Maintenance

Using restore(8)

by ross at 17:39:27 on March 20, 2014

Interactive mode (-i)

For example, if you accidentally delete a file, say /etc/make.conf, you can use restore(8) in interactive mode to restore it:

# cd /
# zcat /share/backup/coffin.lan/root.dump.gz | restore -ivf -
Verify tape and initialize maps
Header with wrong dumpdate.
Dump   date: Sat Oct 11 09:36:15 2008
Dumped from: the epoch
Level 0 dump of / on coffin.lan:/dev/ad1s1a
Label: none
Extract directories from tape
Initialize symbol table.
restore > cd /etc
restore > add make.conf
warning: ./etc: File exists
restore > extract
Extract requested files
extract file ./etc/make.conf
Add links
Set directory mode, owner, and times.
set owner/mode for '.'? [yn] n
restore > quit

Restore prints some warnings about "wrong dumpdate" but works as expected...

To do the same via network replace "zcat" with:

# ssh [email protected] zcat

Restore mode (-r)

The target file system should be made pristine with newfs(8), mounted and the user cd(1)'d into the pristine file system before starting the restoration of the initial level 0 backup.

If the new filesystems are mounted under /mnt, /mnt/var, /mnt/usr, /mnt/usr/home:

# cd /mnt
# zcat /share/backup/coffin.lan/root.dump.gz | restore -rvf -
# rm restoresymtable

# cd /mnt/var
# zcat /share/backup/coffin.lan/var.dump.gz | restore -rvf -
# rm restoresymtable

# cd /mnt/usr
# zcat /share/backup/coffin.lan/usr.dump.gz | restore -rvf -
# rm restoresymtable

# cd /mnt/usr/home
# zcat /share/backup/coffin.lan/home.dump.gz | restore -rvf -
# rm restoresymtable