The following commands can do a full backup and restore for the Ubuntu system. Note that home/YOUR_HOME
is the home directory the logged in user, and the BACKUP_FILE_NAME
can be anything your like.
After the backup is done, you should copy the back up file to some other place, to a NAS server for example, so that you can access it if your Ubuntu is crashed.
Warning: The restore command will overwrite anything you have in the driver without any warning message! Make sure you wanna do it before typing in.
cd sudo tar -cvpzf BACKUP_FILE_NAME.tar.gz --exclude=/home/YOUR_HOME/BACKUP_FILE_NAME.tar.gz --one-file-system /
sudo tar -xvpzf /home/YOUR_HOME/BACKUP_FILE_NAME.tar.gz -C / --numeric-owner