Oh dear. On return from a lovely long weekend away at Piekenierskloof Mountain Resort, we discovered that our XBMC media server had inexplicably died – essentially the primary hard drive just would’t load the XBMCbuntu operating system any more. With a very dejected Jessica (no My Little Pony: Friendship is Magic for her), I set about re-installing XBMC 13.0 “Gotham”, and of course, I became just a little too clever for my own boots.

There are two old hard drives in the old machine, one larger than the other. So naturally I installed XBMCbuntu on the smaller of the two, formatted the larger drive to ext4 and then symbolic linked the Movies and TV Shows folders on the primary drive so that they point to the second drive (essentially I want to store all video content on the larger drive, but without going through all the hassles of maintaining multiple sources in XBMC).

Knowing that I need to auto-mount the second drive in order for this to work, I added the UUID mount command in the /etc/fstab file as per norm, and it was at this time that I spotted some great tips on optimizing drive speed by adding parameters like noatime and data=writeback. Without doing any proper research, I added in the options to all my hard drive mounts in fstab, and of course, on reboot the system fell over.

So how do your recover from a mount fail because of a bad or corrupt fstab file?

Essentially you need to be able to boot into the system with write access and a mounted / path so that you can alter the fstab file and try and get it back into a stable state. To do this, you need to access the GRUB menu and alter the kernel parameters of your Ubuntu load string.

First, if your box doesn’t come up with the GRUB menu automatically before continuing, you can force this by rebooting your computer and holding down SHIFT. Once the GRUB menu is up, select the Linux entry you want to load and press ‘e’ to edit it.

In the edit view, locate the kernel entry – it should look something similar to this:

linux   /boot/vmlinuz-3.5.0-23-generic root=UUID=862e9bd8-8641-478a-96a3-d5ad9a53b104 ro find_preseed=/preseed.cfg noprompt  quiet

Add the following at the end of the kernel entry:

rw init=/bin/bash

Save your changes and launch the edited entry – your machine will boot and you should end up in a bash prompt environment. The / path is mounted in read/write mode, meaning you can now go ahead and edit (read: fix) /etc/fstab, save your changes, and reboot!

ubuntu black and orange logo