2018/01/29

Backup partitions

Here are several samples to backup partitions by tarball.

I wrote this notes when I tried to re-build my laboratory's mail server in 2010.

The following command is to backup the root / partition.

[command]
sudo tar -cvpzf ubuntuXYZ.tar.gz --exclude=/ubuntuXYZ.tar.gz --exclude=/proc --exclude=/lost+found  --exclude=/mnt --exclude=/sys --exclude=/media --exclude=/dev  /

The following command is to backup specific partition (e.g. /home and /etc).

[command]
sudo tar -cvpzf home0129.tar.gz --exclude=/home/home0129.tar.gz   /home
sudo tar -cvpzf etc0129.tar.gz --exclude=/etc/etc0129.tar.gz   /etc

---------------------------------------------------------------

Restore

The following command is to restore data from backup file.

[command]
sudo tar -xvpfz home0129.tar.gz -C /home



No comments:

Post a Comment