Friday, April 29, 2011

Why /home should be on a different partition than /

Nirbheek had advised me to always keep /home on a separate partition, and it came in handy today.

Introduction

Natty Narwhal is the new Ubuntu release made on 28th of April, 2011. When I tried to upgrade to it yesterday, bad things happened.

While the installation went smoothly up to the step Installing the upgrades, it simply hung after trying to Load lirc module on my HP dv2000 laptop. More so, my laptop became unresponsive. The next step I took (I do not know why I did it), was to open a terminal and type:

sudo reboot

The Problem


This was a really bad idea, as it turned out.

The next time I tried to log on, I was greeted with the unfriendly error:
Kernel crash while updating to Natty Narwhal



So the next thing I did was bring out my Ubuntu start-up Flash drive, and booted my system, reinstalled Ubuntu 10.10 while:

  1. Carefully selecting the right partitions for /, /home, /boot and swap, and 
  2. Choosing not to format them.
The installation wizard warned me about folders such as /etc, /lib, etc. existing on the partition, which I shooed away. The installation procedure overwrote the existing files, and finished smoothly.

I also took care to make a different user from my original user so as to not overwrite my existing user directory on /home.

After booting into the system as the new user, I opened a terminal and did the following:

sudo adduser old_user --home /home/old_user    # To re-create the old user
sudo chown -R old_user /home/old_user              # To set permissions right
sudo adduser old_user admin                              # Adding old_user to sudoers list

And right now, I am logged in as old_user, trying to upgrade to Natty again.
(* grin *)

Update: It completed successfully this time.

Conclusions


Now this probably was not the best way of going about it and I did a lot of things just because I was lazy (eg. not taking backup while reinstalling the OS, etc.). But there still are a few important things to be learned from this. The take away messages are:

  1. Keep a start-up disk handy and updated.
  2. Always have /home on a separate partition so in case / is not mountable, one can at least access that partition and extract important data. Am not sure whether I would have been able to recover me /home if it was not on a separate partition.
  3. Most importantly, don't panic.

No comments: