I would like to add my experience of using tar to backup and restore. All the below is done as root.
Backup
Code:
# tar cvpjf backup.tar.bz2 --exclude=/proc --exclude=/lost+found --exclude=/backup.tar.bz2 --exclude=/mnt --exclude=/tmp --exclude=/sys --exclude=/media /
Note: The above assumes you are running the tar command from /
---------------------------------------------
Restore
Code:
# tar xvpjf [path/]backup.tar.bz2 -C /
What I have done from time to time is to backup another distro from another distro eg backup Kubuntu from Fedora. In this case things are a little bit different. Let's assume that I mount the Kubuntu distro under /mnt/kubuntu.
Backup
Code:
# tar cvpjf [path/]backup.tar.bz2 --exclude=/mnt/kubuntu/proc --exclude=/mnt/kubuntu/lost+found --exclude=/mnt/kubuntu/mnt --exclude=/mnt/kubuntu/tmp --exclude=/mnt/kubuntu/sys --exclude=/mnt/kubuntu/media [--exclude=/mnt/kubuntu/backup.tar.bz2] /mnt/kubuntu
You will include [--exclude=/mnt/kubuntu/backup.tar.bz2] (without the square brackets) if the path for your tar.bz file is /mnt/kubuntu ie /mnt/kubuntu/backup.tar.bz2.
---------------------------------------------
When you restore, it is important that you mount the device you are restoring to as /mnt/kubuntu
Restore
Code:
# tar xvpjf [path/]backup.tar.bz2 -C /
It is important you restore to / as the backup process will have saved the files as /mnt/kubuntu/...
After both processes you will need to recreate
Code:
# mkdir [/mnt/kubuntu]/proc
# mkdir [/mnt/kubuntu]/mnt
# mkdir [/mnt/kubuntu]/tmp
# mkdir [/mnt/kubuntu]/sys
# chmod -R 1777 [/mnt/kubuntu]/tmp
The [/mnt/kubuntu] is provided for in case you did the 2nd part. Make sure that your /boot/grub/menu.lst and /etc/fstab still references the correct devices.