Wednesday, 9 July 2008

Backing up your system with Remastersys

I've previously mentioned how to set up /home on a separate partition to help ensure that your data is safe if anything goes wrong with your Ubuntu install. However, we all like to add a few extra applications and other things, and if anything goes wrong, it will take you a long time to reinstall these. How can you make this easier?
Simple, use Remastersys. This incredibly handy utility allows you to create your own customised install CD based on your Ubuntu or Linux Mint installation. It's actually used to create a few Ubuntu derivatives, and you can quite easily use it for this purpose yourself if you so wish, as you can use it to create a distributable copy. I now have a DVD based on my Kubuntu install so I can easily reinstall it if anything goes wrong, and it includes all the multimedia codecs so everything works out of the box. And it's extremely easy to use.
So, how do you install it? It's not in the Ubuntu repositories, but there is a Remastersys repository which you can add. Just enter the following:
sudo vim /etc/apt/sources.list

As always, you can use nano or another editor if you prefer. Now add the following lines:
# Remastersys
deb remastersys/

Now run the following commands to install it:
sudo apt-get update
sudo apt-get install remastersys

Before you run it, you may want to change some of the settings. These are in a text file at /etc/remastersys.conf. This file is very straightforward to use, and everything is well signposted - you can easily change the name of the customised CD by editing this file.
Now, when you run Remastersys, it will create an ISO image based on your current install, so for instance if you're running Ubuntu but have added the Kubuntu desktop, it will be on the CD as well.
Before you run it, close down every other application you are running as they can affect the build. There are two ways you can run it. To back up everything, including user's directories, run the following:
sudo remastersys backup

If you're planning to distribute copies of this to other people, for instance if you are using Remastersys to create your own distro, you won't want to run this. Instead, run this command to create a distributable version which you can give to others:
sudo remastersys dist

The process can take a while, especially if you have a lot of applications installed. Be aware that ISO images of over 2GB can have trouble booting, however don't worry if your system takes up more space than that as it's compressed significantly when the ISO image is built (the standard Ubuntu install takes up around 2GB when installed, but around 700MB as an ISO). Please also note that an image larger than 700MB will need to be burned to a DVD.
Once the process has finished, if you go to the /home directory, you'll notice an extra user directory has been added - Remastersys. Go into this directory, and there's another Remastersys folder inside that. Inside you'll find your new ISO image, which you can move to your own home directory, along with an m5d checksum.
Now that's done, you can clear up the build directory. This is easy, just enter the following:
sudo remastersys clean

Make sure you've moved the ISO to your own directory before you do this. Now you can use whichever CD-burning tool you prefer to burn the disc to a CD or DVD, and you now have your own customised Ubuntu!
There are endless uses for this. I've been experimenting with creating my own distribution using this method - so far it's pretty poor, but it's educational. With a distributable copy of your install and with your /home directory on a separate partition, it's easy to restore your system in case anything goes wrong. You can create a copy of your install and run it in VirtualBox so that you can use that as a test bed for any changes you might want to make. And it can be handy to have with you as it means you can boot any computer into your own familiar desktop environment, with your own favourite applications, without having to install a thing. I urge you to try it!


Noodler said...

This is great! Is there anyway to boot the image from a USB drive?

MattBD said...

UNetbootin may work for this - it allows you to put an ISO image on a USB pendrive and make it bootable really easily. You can find it here.

great hill said...

becareful it destroys Firefox and flock bookmarks, profiles. Causing headaches in reabling.

Use another means of backing up which are far safer.

Besides there are ISO limitations for those of us with a lot of stuff. So forget Remaster, and again back up your system with another program.

Remaster has failed me, and very serverly.