otrdiena, 2011. gada 25. janvāris

System backup on-the-fly

Create:

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

For better compression, but it takes longer time:
# tar cvpjf backup.tar.bz2 --exclude=/proc --exclude=/lost+found --exclude=/backup.tar.bz2 --exclude=/mnt --exclude=/sys /

*At the end of the process you might get a message along the lines of 'tar: Error exit delayed from previous errors' or something, but in most cases you can just ignore that.

Restore:

# tar xvpfz backup.tgz -C /
# tar xvpfj backup.tar.bz2 -C /

Just make sure that, before you do anything else, you re-create the directories you excluded:
# mkdir proc
# mkdir lost+found
# mkdir mnt
# mkdir sys

etc...

Nav komentāru:

Ierakstīt komentāru