23.4 Using tar

   

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.

Creating a Backup with tar

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 

Restoring Data Using tar

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 Break

Creating Incremental Backup

After learning backup and recover methods , let's create an incremental backup using the fbackup command. First, create a graph file to include directories /sbin , /home and /etc . Use this file to create a backup at backup level 0 without the -u option. Now create a backup with the same graph file at level 1. You will see that this is again a full backup instead of an incremental one. This is because the fbackup log file was not updated during the last backup, as you did not use the -u option. Remember to also use the -g option whenever you use the -u option. Now create a backup at level 0 with the -u option. After that, another backup at level 1 will be an incremental backup.


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net