Last weekend I reinstalled my Linux system (and not because I want to rename it as Pyg!) which is a very bad decision as it is the same time that my pitiful internet connection fails to transmit any data beyond a few bytes. The new install to Ubuntu 15.04 (Vivid Verve) gave me the confidence to start using btrfs which is being touted as the next generation file system for linux systems. Bad move and very short-sighted on my part.
The btrfs is supposed to provide enhancements to ext4 file system since it (btrfs) is built from the ground up but with the useful features already present in ext4. The ext4 filesystem is basically being viewed as an aging hack on a hack since it builds on ext3 which is a tack-on improvement for ext2. Btrfs might be delivering on some of its promised features but those who use it should still be wary of it as it is still not considered as ready for “production” or real-world use. I wish I knew this before I chose it as the filesystem for my home directory.
For those that will have the misfortune of encountering it, the gist of my predicament follows (which is based on how I remember it):
- I upgraded my system using dist-upgrade.
- I encountered a severe freeze which left me with no choice but to reach for the power button.
- System bootup hangs. The last entry goes something like this:
- Eventually the bootup hangs and it drops the control to an emergency shell.
A start job is running for /home… (10s /no limit)
It was unnerving for me since a reinstall means I would need to re-download the upgrade packages on my #@$@#$ Smart LTE connection. The light-bulb moment for me was that /home is the only partition in the sequence that is using btrfs. The working theory is something borked during the forced shutdown which should have been handled by the journalling features. Thanks to an alternate albeit slow alternative connection, I was able to google enough to do the following:
- Boot the machine and press F12 after the BIOS/UEFI prompt.
- Selected the menu option for Ubuntu Advance options.
- Selected the option for “(recovery)”
- Selected the “drop to root shell” option.
- Remounted the root system in r/w mode. I dont think this is needed but this is what I have done and it won’t hurt anyhow.
- Did a btrfs file system check on the home partition
- When nothing popped out, I went for the repair option.
# mount -o remount,rw /
# btrfsck /dev/sda4
# btrfsck --repair /dev/sda4
The repair option is always accompanied by a cautionary warning as it can delete information so having a proper backup is recommended. In my situation that is like adding salt to the injury. When I ran the repair option it reported that the cache and super generation areas do not match and that it cleared the space cache. After doing so I ran another btrfsck on the partition and rebooted the system which thankfully landed me on a working system with no (identified) data loss.
The moral of the story is to select btrfs only for the filesystems that you can afford to lose data; or have a good backup scheme. Using it for /tmp is going to be an overkill but to each to his own. Now Im thinking if I want to convert my home partition back to ext4. 😀