Moving Grub from the MBR to the Install Partition

I realize this is nothing new to experienced Linux users, but I figured I’d document the process I used to move GRUB from the master boot record (MBR) of my notebook’s hard drive to the partition where I had Linux installed. I got the steps straight out of the Ubuntu forums as a result of a Google search for “move grub mbr.” The reason I am moving it is because, as I write this, I am using TrueCrypt to encrypt my entire Windows partition. To be able to boot Linux, I needed to move GRUB to make room for the TrueCrypt boot loader, since the MBR ain’t big enough for the both of them!
So, the process was:

  1. Identify the partition in which Linux is installed.
    mount
    Look for the / partition, which, in my case, is /dev/sda2 (as /dev/sda1 is where Windows lives on this machine).
  2. sudo grub-install /dev/sda2
    Voila! GRUB now lives in /dev/sda2 (as well as in the MBR).

Of course, there’s no real way to verify that this will work until you overwrite the MBR with something else, as GRUB still lives in the MBR, so effectively nothing has changed. In my case, I installed the TrueCrypt boot loader in the MBR. I then booted and selected my Linux partition from the TrueCrypt boot loader, which brought up my friendly GRUB boot menu! Now assured that things were working and that I could get back into Linux, even if I somehow hosed my Windows partition, I continued on with encrypting the entire partition.