Ubuntu and Linux Tar Backups
As you may spend hours and hours configuring and setting your current installation, it is a good idea to make sure that you do not lose all that hard work and customization that enables you to use your Linux variant as you wish. There are many methods for which to backup your existing installation such as, making iso files, cloning the installation with Clonezilla and good old tar files.
The examples below show how to create backups of the entire file system or parts of the file system. If you are hoping to move a server to a new machine, you could clone the entire disk and make an iso file, or you could make a fresh installation and extract the tar ball and overwrite the files. Making tar backups is much faster and easier than making an iso, especially with a larger file system.
Tar backups can be used to backup the entire file system “/” or various parts of the file system.
Backup the entire file system but do not include the tar backup file
root# tar cjvf ubuntu_backup.tar.bz2 --exclude=/ubuntu_backup.tar.bz2 .
Backup the file system but do not include some folders (Method A)
root# cd /
root# tar cjvf ubuntu_backup.tar.bz2 --exclude=/ubuntu_backup.tar.bz2 --exclude=/home/username/tunes --exclude=/media --exclude=/boot --exclude=/sys --exclude=/proc --exclude=/mnt /
Backup the file system but do not include some folders (Method B)
root# cd /
root# tar cjvf ubuntu_backup.tar.bz2 --exclude=ubuntu_backup.tar.bz2 --exclude=home/username/tunes --exclude=media --exclude=boot --exclude=sys --exclude=proc --exclude=mnt .
Checking Tar Backups
root# tar tjvf ubuntu_backup.tar.bz2 |less
root# tar tjvf ubuntu_backup.tar.bz2 | grep etc |less
To move the tar file,
1) Copy and paste to usb .. or use ssh and scp the file to another machine.