Join the community, get access to exclusive contents and discussions.
Grab tips and tricks from experts.
We are in-need for your support and participation.
Join now as we regularly update the website for your needs.
Leave your suggestion on our contact page. We'll
promise to do our best to make your request possible!
Linux Server – Backup the entire system using tar with compression
The above command is on multiple lines for readability. Enter everything on the same line when entering the command in the editor. Once entered, exit the editor (Ctrl-X) saving the file.
The c option creates the backup file.
The v option gives a more verbose output while the command is running. This option can also be safely eliminated.
The p option preserves the file and directory permissions.
The f option needs to go last because it allows you to specify the name and location of the backup file which follows next in the command (in our case this is the /mnt/fullbackup.tar.gz file).
To enable the compression you have to add the z switch to both the tar-ing and untar-ing commands. You also have to change the file name to indicate the compression. Our tar-ing command becomes:
The –directory option tells tar to switch to the root of the file system before starting the backup.
We –exclude the directory that contains are backup file.
tar -zcvpf /mnt/backup/wholesystem.tar.gz --directory=/ --exclude=proc --exclude=sys --exclude=dev/pts --exclude=backups .
Likewise, our untar-ing command becomes:
tar -zxvpf /fullbackup.tar.gz
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic. Login here