https://help.ubuntu.com/community/BackupYourSystem/TAR is a simple guide that may help.
My current system is Ubuntu 12.04, and I would like to clean out all the junk that I’ve created over time and start fresh with Ubuntu 14.04 LTS server this time. So I am going to backup the current system and save key items to ensure I have all I need for the new system.
First – this is the simple way just to save it all:
cd / tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz --one-file-system /
A little more complicated backup, excluding a number of directories would look like this:
tar -cpzf /backup.tar.gz \ --exclude=/dev/* \ --exclude=/home/*/.gvfs \ --exclude=/home/*/.mozilla/firefox/*/Cache \ --exclude=/home/*/.cache/chromium \ --exclude=/home/*/.thumbnails \ --exclude=/media/* \ --exclude=/mnt/* \ --exclude=/proc/* \ --exclude=/sys/* \ --exclude=/tmp/* \ --exclude=/home/*/.local/share/Trash \ --exclude=/etc/fstab \ --exclude=/var/run/* \ --exclude=/var/lock/* \ --exclude=*/tmp/* \ --exclude=/lib/modules/*/volatile/.mounted \ --exclude=/var/cache/apt/archives/* \ --exclude=/.cpt* \ --exclude=/aquo* \ --exclude=*/wp-content/cache/* \ --exclude=/backup.tar.gz \ --one-file-system /
It will save everything on your one partition into one file, then you can extract any portions that you want from it.
Now, once you want to restore all or some of it, use the following:
targetfile1 should be the file or directory you want extracted to the current directory, or if you include the “-C” option, to “anotherDirectory/”.
tar zxvf backup.tar.gz targetfile1 -C anotherDirectory/
Leave a Reply