Date Tags Linux

As you might have already experienced (why else would you care to read this post?), the installation of Windows-flavoured operating systems kills existing bootloaders (like GRUB), so you won't be able to boot other OSes from your hard drive any longer. If you are using GRUB, you can attempt to restore the situation before the Windows installation by grabbing a live CD of some Linux distribution and by performing the following actions.

  1. Boot the live CD.
  2. Open up a terminal and get yourself root access to your machine (depending on the chosen distribution, this might vary slightly).
  3. Execute the following commands.

    $ sudo mkdir /mnt/root
    $ sudo mount -t ext3 /dev/<LINUX_PARTITION> /mnt/root
    $ sudo mount -t proc none /mnt/root/proc
    $ sudo mount -o bind /dev /mnt/root/dev
    $ sudo chroot /mnt/root /bin/bash
    $ sudo grub
    

    This mounts the partition of your Linux system (substitute appropriately), as well as the proc subsystem. The chroot command allows GRUB to discover your hard drives. After executing sudo grub, you will see the GRUB console interface.

  4. Find the location of GRUB-related files.

    grub> find /boot/grub/stage1
    

    This should yield something like (hd0,1).

  5. Scan that partition, so that GRUB can recognize the type of its filesystem. Trigger the actual setup process.

    grub> root (hd0,1)
    grub> setup (hd0)
    

And that's it! After you have restarted your machine, you should see GRUB again and be able to switch between your Linux and Windows systems.

Hi there! I'm Markus!

I'm an independent freelance IT consultant, a well-known expert for Apache Kafka and Apache Solr, software architect (iSAQB certified) and trainer.

How can I support you?

GET IN TOUCH