tar system backup&restore

Backup:

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

or

tar cvpjf backup.tar.bz2 --exclude=/proc --exclude=/lost+found --exclude=/backup.tar.bz2 --exclude=/mnt --exclude=/sys /

Restore:

tar xvpfz backup.tgz -C /

tar xvpfj backup.tar.bz2 -C /

+
mkdir proc
mkdir lost+found
mkdir mnt
mkdir sys

Tar Over SSH

tar -cpzf - ./ | ssh remoteuser@remotehost tar -C /path/to/remote/dir -xpzf -
tar -cpzf - ./ | ssh remoteuser@remotehost "cat > /path/backup.tgz"
ssh remoteuser@remotehost "tar -cpzf - --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys /" | tar -C /path -xpzf -

Leave a Reply

Your email address will not be published. Required fields are marked *