The tar method is the traditional UNIX backup and restore method. Its major benefit is that it can be used across many manufacturers' UNIX computers. The same command is used both for backup and restore purposes. The backup created using tar makes efficient use of the media.
To create a backup of the /etc and /home directories using the tar command on a tape device, the command is as follows . The tar command uses /dev/rmt/0m as the default tape drive, so you can omit this on the command line.
# tar -cvf /dev/rmt/0m /etc /home a /etc/MANPATH 1 blocks a /etc/PATH 1 blocks a /etc/SHLIB_PATH 1 blocks a /etc/SnmpAgent.d/snmpinfo.dat 111 blocks a /etc/SnmpAgent.d/snmpd.conf 14 blocks a /etc/TIMEZONE 1 blocks a /etc/X11/X0screens 35 blocks a /etc/X11/X0devices 16 blocks a /etc/X11/X0pointerkeys 25 blocks a /etc/X11/rgb.txt 43 blocks a /etc/X11/XHPKeymaps 553 blocks a /etc/X11/fs/config 3 blocks a /etc/X11/rgb.dir 8 blocks a /etc/X11/rgb.pag 58 blocks a /etc/X11/C/print/attributes/document 2 blocks <Some part of the output is truncated here>
The -c option is used when creating a backup. You can also create a tar backup file on another file system instead of on a tape device. For this purpose, use a file name with the -f option instead of the device name. To create a tar backup of the /home directory in a file, /extra/home.tar , use the following command.
tar cvf /extra/home.tar /home
To list the contents of a tar backup, use the -t option with the tar command. The following command lists the contents of a tape device.
tar tvf /dev/rmt/0m
You can also use the command as follows, as /dev/rmt/0m is the default tape drive used by the tar command.
tar -tv
To restore data from a tar backup, use the -x option with the tar command. The following command restores data from a tape backup device.
# tar xvf /dev/rmt/0m x MANPATH, 279 bytes, 1 tape blocks x PATH, 163 bytes, 1 tape blocks x SHLIB_PATH, 9 bytes, 1 tape blocks x SnmpAgent.d/snmpinfo.dat, 56769 bytes, 111 tape blocks x SnmpAgent.d/snmpd.conf, 6959 bytes, 14 tape blocks x TIMEZONE, 21 bytes, 1 tape blocks <Some output of the command is truncated here>
Study BreakCreating Incremental Backup
|
Top |