User Tools

Site Tools


redhat:simple_backup_and_restore_a_complete_linux_system

Simple Backup and Restore of a complete Linux system

Source: http://www.linuxhaxor.net/2008/11/20/complete-backup-and-restore-using-tar-command/

Backup:

# Create a full backup of the Linux system

tar -cvpznf /backup/backup.tgz -g /backup/backup.inc --exclude=/backup/backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/media --exclude=/sys / 

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

Restore:

WARNING!! This will overwrite every single file on your partition with the one in the backup archive!

To complete the restore the directories that we excluded in the above backup command using the “exclude” flag will be created afterwrads:

tar xvpfz /backup.tgz -C /

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 recovery, for instance, if you have a corrupt or mis-configured file called “file” in the directory “/directory” you want to recover, you could simply issue the command:

tar -zxvpf /backup.tgz /directory/file
redhat/simple_backup_and_restore_a_complete_linux_system.txt · Last modified: 2014/10/12 00:39 by 127.0.0.1