I covered creating an IPcop backup script last time. This time around I want to go over a backup script I’ve been using for an Ubuntu box. The script works just like the IPcop script with some slight modifications made to accommodate Ubuntu’s file system. In my case I mounted a separate volume at /media/backup. Either copy or create the following files in that location and modify them to fit your needs. If you want to ignore any files or folders for any reason simply add them to the ignore.txt file and they will be skipped. Remember to ignore any network mount points you may have, otherwise that MP3 collection on your other box is going to end up in your new 40gb backup tar file 😉
tar cvpzf /media/backup/backup-$DATETMP.tgz –exclude-from=/media/backup/ignore.txt /
# change j to z for less compression
/media/backup/backup* #You must exclude the backup directory, otherwise you will end up with an archive 2x its normal size!
A this point you just need to execute the following to start your backup:
To restore your configuration, install the same revision of Ubuntu that you had running previously. Copy the backup file to a location on the newly re-built system. Then you can execute the following command:
sudo tar xvpfz backup.tgz -C /
If you chose the higher compression level above then you would execute:
sudo tar xvpfj backup.tgz -C /
At this point you just need to re-create the folders we ignored earlier.
sudo mkdir /proc /mnt /lost+found /sys
Reboot the system and enjoy!