Preparing for System Failure ... And Recovering Quickly

|

Despite the improvements made each year by GNU/Linux, KDE, and GNOME, recovering from failure is one of the recurring themes many new users struggle with. Why aren't we making it easier to prepare for, and recover from, failure? Here are some proposals to make recovery less painful.

Change the Default Drive Partitioning

Instead of just complaining I thought I'd throw out some ideas of my own. One of my previous posts spoke about A Need for Kubuntu Live CD Repair Tools. With this post I'm going to focus on run time solutions.

My first suggestion is how we partition our systems by default. This is important because a simple change up front can make it much easier to recover later. I'm talking about creating three partitions instead of the two that many installers default to. They should be /, /home, and swap partitions. With the large drive sizes these days it's usually easy to allocate 10 GB to /, 1 GB to swap, and the rest to /home.

This matters because it prepares us for the total meltdown situation where if all else fails we must format and reinstall. The great thing about breaking out the /home directory is that you can reinstall the OS without touching your personal data and settings. During the reinstall you only have to tell the partitioner the location of your existing /home partition. And this is the important part: DO NOT FORMAT IT! Only mount it.

By doing this you can spend ~20 minutes to completely rebuild your system and your personal settings will already be applied. It will be longer if you have to download packages though.

It's also a good idea to regularly backup the data on your /home partition. This will guard against drive failure or accidental deletion. Many backup tools even let you create snapshots where you can restore previous versions of a file.

Reinstalling the Right Software

Some readers may notice the flaws in my previous suggestion. Any system wide setting changes will be lost and the installed software will be back to the defaults, without any of the packages you installed separately.

In my opinion the former is more of a feature because it's likely one of those settings was the problem anyway. Any others that do need to be reset will be minimal.

Getting the right software installed is more important because it can take a lot of time to figure out what's missing and automating the process can save time and stress. There is good news for those of you who use Debian or Debian-based distros like Ubuntu, Kubuntu, Mepis, Linspire, Xandros, and others. The package management system makes this easy.

The first file than needs to be backed up is sources.list. This file contains the list of your repositories to the system knows where to get your software. It can be found here:

/etc/apt/sources.list

The next step is getting a list of the installed packages. That can be done using the following command.

dpkg --get-selections > dpkg-selections

After a reinstall, you can install the list of packages with the following commands.

dpkg --set-selections < dpkg-selections
apt-get dselect-upgrade

If you run those commands from your home directory the dpkg-selections file will be saved there. Another location could be chosen if you prefer. The file can be deleted once you have completed the upgrade.

Conclusion

These are some basic steps that anyone could do if they stopped to think about it, but why should they have to? That's one of the great benefits of computers. We can use them to do the rote work for us. Simple changes like setting up the partitions correctly are easy to do and provide a firm foundation to recover from future problems.

Distro aware backup tools could also make it easy to reset up a fresh system from a backup. The capability to backup and restore a software list should also be an easy addition for programs like Adept and Synaptic.

The first tipp for beginners should be to have BACKUPS!

Totaly agree with all your Points
(maybe / on a 300gb+hd 20gb)

But two very possible errors are 1. Hard disk failure and 2. Problem sits in front of PC!.
If 1) Home is byebye
If 2) Could be for example delete a projekt ordner.. something like rm -rf on /home :-)

So on all helps for a system failure recovery i strongly urge for:
A regular Backup of /home,
/etc(for reference)
and any other path that is important (/var/www... )
This should be at least on a second hard disk or dvds.
With disk space this cheap every serius user should have a extern XXX GB Hard Disk. No excuses for this.

Of course this is only the minimal! single user case.