Linux Backup/Restore

tar

Used to backup/restore files to a tape drive. Tar can be used to archive a group of files into another file or more commonly to write/restore a group of files to a tape drive.

Options Description
c create a archive (write to tape)
t display files on archive (view only)
x extract from archive (read from tape and write to disk)
v verbose – display filenames
z compress files (using gzip)
f device name or file name to write to
directory or file directory or file to use

Note: The following examples assume the device name of your tape drive is /dev/st0.

Command What it does
tar cvf /dev/st0 / backup the entire system to tape
tar cvzf /dev/st0 /bin only backup the /bin directory to tape and compress
tar tvf /dev/st0 view the contents of a tape
tar xvf /dev/st0 restore the entire contents of the tape
tar xvf /dev/st0 /etc/sendmail.cf only restore the file ‘/etc/sendmail.cf’ from tape
tar xvzf /dev/st0 /bin restore and uncompress the directory /bin from tape

top of page


mt

The mt command can be used to erase, retension or to set compression mode.

Note: The following examples assume the device name of your tape drive is /dev/st0.

Command What it does
/usr/sbin/mt -f /dev/st0 retension Retension
/usr/sbin/mt -f /dev/st0 erase Erase
/usr/sbin/mt -f /dev/st0 datcompression Turn compress on

top of page