It is often convenient to have online listings of the contents of system backup tapes. For one thing, they make it much easier to figure out which tape has the file you need to restore, especially when multiple levels of incremental backups are in use. It is quite easy to create such files at the time the backup is performed.
If you’re using
cpio for backup, you can take advantage of the
-v option to create a listing of the
tape’s contents as it is written, as in these examples:
tar -cv /home > /backup/home_full_$today.TOCor $
tar -cv /home | tee /backup/home_full_$today.TOC
tar commands archive the
contents of /home, generating a
long, directory-like listing as it does so and saving it to a file with
a name like /backup/home_full_21mar1995.TOC. The second
command also displays the same output on the screen.
cpio sends the file list to
standard error, so it must be captured slightly differently:
find /home -print | cpio -ov > /dev/rmt0 2> $toc
If you want to use the C shell, the commands are a little different:
set toc='date +/backup/home_full_%d%b%y.TOC'%
(find /home -print | cpio -ov > /dev/rmt0) >& $toc
The file lists produced by
commands like these contain only the pathnames of the files in the
archive. If you want a more detailed listing, you can generate it with a
cpio command or a more complex
pipe leading up to the
cpio -itv ...