Backup Commands in Linux & Unix with Usage and Examples
Unix and Linux backup and restore can be done using backup commands tar, cpio ufsdump, dump and restore. Though these commands may be sufficient for small setups in order to take a enterprise backup you have to go in for some custom backup and restore solutions like Symatic netbackup, EMC networker or Amanda.
Any backup solution using these commands depends on the type of backup you are taking as these backup commands offers different capabilities.
In this article learn about :
1. backup command tar – how to use tar for backing up unix and linux files
2. backup command cpio – how to use cpio for backing up unix and linux files
3. backup commands ufsdump and restore for Solaris filesystem
4. backup commands dump and restore for taking Linux file system backup.
Backup restore using tar command
1. Used for single or multiple files backup .
2. Can’t backup special character & block device files ( 0 byte files ).
3. Works only on mounted file system.
Backing up all files in a directory including subdirectories to a tape device (/dev/rmt/0) or a file.
tar cvf /dev/rmt/0 *
tar cvf /home/backup * ## backups files in current directory to a file named backup
Viewing a tar backup on a tape or file
tar tvf /dev/rmt/0
tar tvf /home/backup ## view files backed up inside the backup
Extracting tar backup from the tape
tar xvf /dev/rmt/0
tar xvf /home/backup ## restore files in to current directory.
(Restoration will go to present directory or original backup path depending on
relative or absolute path names used for backup )
compress -v file_name
To uncompress a file
NEXT >> Backup restore using cpio command