Friday, October 11, 2013

The secret of ultra-fast Linux reinstalls

I've been a linux user since 1999 both at home and work. (Yes, I do use Windows sometimes, but only for testing purposes and gaming.) Since the beginning I installed various linux distributions countless times. I don't like distribuition upgrades as I always want to see the latest edition in all it's glory via a clean install, but I also need some of my old settings and usually need to be able to use the computer fully in less than 60 minutes.

There is a very simple trick to achieve this: Use a seperate /home partition.

My hard disk is set up like this usually:

  • root partition ( / ) 16GB
  • swap partition ( swap ) 2GB
  • home partition ( /home ) All the rest
When I need to reinstall (Ubuntu 12.10 is coming soon), first I log out, then press ctrl + f1 to enter the terminal and rename my home direcory adding -old at the end. (/home/tenchi => /home/tenchi-old)

I press ctrl + alt + delete to restart the machine with the boot media and start the install process. After choosing custom partitioning, I resuse my existing partitions taking care not to format my home partition. When the installer asks for a username, I can choose my usual as I renamed the old home directory.

After the installer finishes and the machine rebooted, I am welcomed by a totally clean install. I start the usual updates and during waiting I move the documents and settings I want to keep from the old home directory to the new one.

Settings are usually in seperate hidden directories starting with a dot like .skype, .mozilla. Some are harder to find and you have to dig a bit deeper into .config or .kde. Moving the config directories to your new home directory will make your favorite programs retain your settings.

It is also a good idea to start even before the install with making a list of all the software you use daily. If they are in the default repositories, you can use the software manager or synaptic to install them all at once. Just don't forget to restore their settings before you launch them for the first time.