Upgrading Windows Vista or 7RC to Windows 7 on dual boot with Linux (Ubuntu)

As you may or may not know, the Windows 7 RC/beta/other releases expire at the latest on March 1st, 2 days from now. So I had to spend some time this weekend upgrading to a full Windows 7. Fortunately, my school offers Windows 7 Professional for free if you're an engineering student (so we do get special treatment, aw!).

Anyway, if you're like me, you're dual booting Windows + Linux, and you have to reinstall Windows, you were probably using GRUB to boot into your OS. Well, as it turns out, reinstalling Windows wipes out GRUB from the boot record. Oh no! What to do?

Fortunately, the solution is simple. I searched for "restore grub" and found this excellent guide.

The summary:

  1. Get a Ubuntu Live CD and boot from it.
  2. Then run these in your terminal:

    sudo -i
    
    # get a list of your partitions in /dev/sdX format
    fdisk -l
    
    # if you can't decide which one is your linux
    # partition (see the System column?)
    df -Th # lists partitions with size and % used
    
    # mount your Ubuntu partition, mine was sda4
    mount /dev/sdXY /mnt #
    
    # install grub on the partition, mine was sda
    grub-install --root-directory=/mnt /dev/sdX
    
    # be nice and unmount it, to avoid problems
    umount /mnt
    
  3. Reboot. Done! Your old GRUB shows up now.

So that's it. Hope this helps you avoid reinstalling Linux, which is really unnecessary :)

Longevity by Uplift

Think a long life has to come with losing your mind or your body? Think again! Age is strength. 💪 Mind & body movers for how to live a long, healthy and balanced life on your own terms.

Get a few carefully curated articles once a month. Here's a sample.