Linux backup and restore using tar command

By Detector | 24 November 2008



Real, reliable, automated backup requires an infrastructure of disparate requirements that is really easy to screw up. I would be surprised if more than 5% of desktop GNU/Linux users are currently practicing an automatically scheduled backup regime, and maybe a tenth of those have off-site backup as well. Heaven help those in the way of the next lightning strike, flood, fire, or PC-pulled-off-desk-by-curious-infant etc. So, backups are almost a necessity. There is a lot backup mediums but I found an external USB drive for all my backup data as most practical. In this post I will explain you how to backup your Linux on the easiest and most simple way. For this method you will need nothing, just simple standard “tar” command:

tar cvpzf backup.tgz –exclude=/proc –exclude=/lost+found –exclude=/backup.tgz –exclude=/mnt –exclude=/media –/sys /

This is just a simple backup using the “tar” command but can be included in a more sophisticated approach if we want to include more vital folders of our system.

Restoring of the backup is as simple as backup itself, just login with root and type on a command line:

rar xvpfz backup.tgz –C /

To complete the restore process create the directories that you excluded in the above backup command using the “exclude” flag:

mkdir proc
mkdir lost+found
mkdir mnt
mkdir media
mkdir sys

By using the “tar” command to backup your data, you have the ability to extract any file or directory out of the “backup.tgz” file for recover.

No matter how complex your system, you will find the “tar” procedure to be the most widely used and most reliable for any backup solution.

Tags | , , ,

| |

Comments are closed.





Archives

Add to Technorati Favorites
website stats
TwitterCounter for @ukion