Phew, done it! I decided to put a solid-state disk (SSD) on my new Linux system, to get some experience of using them. I expected to run into a few obstacles, but as usual with Linux I also expected to figure them out with a judiciously worded Google query. (Open-source would not work without Google).
It wasn't that easy. My goal was to move my existing system. A re-install from scratch would have been easier but then I'd have to try and remember all the hundred or so packages I've installed since, remember how I configured things like Apache and MySQL...
With Windows of course this is impossible. Thanks to that brilliant invention (not), the registry, you have to reinstall from scratch every time, then spend hours locating the CDs and babysitting the installation process. Been there, done that, and it's one of the main things I dislike about Windows.
I googled around and found a few descriptions of what to do, and indeed it seemed easy. So I physically installed my brand new 64GB SSD, which worked fine, and copied everything on my 1TB hard drive (not that much) to it. The of course I just needed to make it into a bootable system... and that is where the fuin started.
Ubuntu uses a boot system called Grub. I'd found clear instructions how to run that. Unfortunately for me, I just upgraded to Ubuntu 11.04 ("NattyNarwhal"), which uses Grub2, not Grub. And of course, they are completely incompatible - they don't seem to have a single command in common. (This seems to be a fairly widespread disease in the open-source world, deciding to reinvent some well-known piece of the system and make it gratuitously different. The most egregious example is Python 3, though bjam, the build system for Boost, runs a close second).
And I just could not find how to make Grub2 make changes to anything other than the currently running system. I could install it on the SSD, but trying to boot from it was a failure. Ubuntu finds file systems by their unique ID (UUID), and the SSD system was looking for the old hard drive's UUID. If both drives were plugged in, the SSD would boot Grub which then cheerfully booted from the hard drive. But if not... not so good.
I tried creating a "Super Grub 2" boot CD, hoping I could use this to make the changes. This however deserves some kind of award for unhelpful software. There is no "help" command and as far as I can tell no documentation either. So that was out.
By now I'd spent (wasted) two whole evenings on this project. Only my intense natural reluctance to give up on things kept me going, since I didn't actually need this to work. Then I tried a slightly reworded Google query and found this article. If you're an experienced Linux sysadmin you're probably thinking, "What an idiot, everybody knows that's how you do it". But I didn't know...
The key to success, once the files have been copied and /etc/fstab edited, is the following:
for f in sys dev proc ; do mount --bind /$f /ssd/$f ; done
The magic here lies in the chroot command, which is what gets Grub to work on a different drive from the current one. Now I know about it, I'm sure I'll find all sorts of other places to use it.
That done, the SSD booted perfectly by itself, and with a bit of juggling of SATA connections, I got it to boot with the hard drive as well. Problem solved.
By the time I finished this, I was ready for a glass of wine and dinner. So I can't yet say whether the SSD has indeed given me the expected boost in system performance. But at least I've got it working.
Post a Comment