Page 1 of 1

How to recover GRUB after Windows re-install Rate Topic: -----

#1 CBart21  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 21
  • Joined: 28-October 06

Post icon  Posted 15 October 2009 - 03:53 PM

Have you ever attempted to reinstall Windows Vista on a Windows/Linux dual boot only to find yourself only booting into windows? I recently did! How frustrating! I finally found out how exactly to go about fixing the problem. If you ever find yourself in this situation, I hope these next steps will get you to where you need to be.

NOTE: I am using Windows Vista / Kubuntu 9.04 Dual Boot in this example.

The first thing you need to do is find a Live CD you can boot into. This can be just about any Live CD, but for optimum results use one that shares the same Linux distribution that you use. Boot into this CD and open up a prompt.

The next thing you have to do is find out what device your Linux partition is running on. This can easily be accomplished using the following commands:

fdisk /dev/xxx


xxx is equal to any of the following directly from fdisk(8) man pages:

(/dev/hd[a-h] for IDE disks, /dev/sd[a-p] for SCSI disks, /dev/ed[a-d] for ESDI disks, /dev/xd[ab] for XT disks)

You will be given a list of options and a prompt to type in your choice. Use the choice 'p' to print your partition table and hit "Enter".

The table will be printed to the screen in which you can deduce which device your Bootable Linux Partition resides in. Once you figure out the device, make a note of the device string. Mine is: "/dev/sda5"

NOTE: There will be two or more Linux Partitions on a simple partition table. One is the root partition and the other will most likely be the Linux Swap partition. Make sure you note the correct device.

Good job! Now you're ready for the meat of the process.

You will need to make a new directory to hold the mounted partition that will be your Linux partition. This will make more sense to you as we progress through the rest of the process. The command is:

sudo mkdir /mnt/system


Next, you need to mount your Linux partition to this new directory so we can access all the files on your Linux Operating System.

sudo mount /dev/xxxx /mnt/system


In my case, 'xxxx' would be 'sda5'. You're Linux partition may be different.

The next few steps involve "chroot'ing" into this new mounting partition. When you 'chroot' to a mounted device, you are literally changing the root directory of the LiveCD system to the root directory of the mounted device. What this does is it allows you to run commands directly on the Linux partition that you specify instead of running the commands on the LiveCD.

The first thing you need to do is take control of the root user.

sudo -i


You do this so you can run the 'chroot' command.

Now, you need to bind the /dev tree from the LiveCD file tree to the mounted Linux Partition using the following command:

mount -o bind /dev /mnt/system/dev


Now, chroot into our partition.

chroot /mnt/system


Finally! We are inside our Linux partition. We have one more command left. What this command does is reinstall and configure our Grub Bootloader so that we can boot into either Windows or Linux when we restart.

grub-install /dev/xxx


'xxx' refers to the three character description representing our hard-drive.

We are finally finished!

All you have to do is restart! We now have choices when we boot up our computer!


**Please note: This post is for my own reference. However, if do find yourself stuck with this little situation, I hope this helps you out!**


P.S. If you want to change the default choices in the bootloader you can edit the file "/boot/grub/menu.lst"


Thanks for reading!


--Chris

Is This A Good Question/Topic? 1
  • +

Replies To: How to recover GRUB after Windows re-install

#2 Guest_arun*


Reputation:

Posted 18 July 2010 - 08:09 PM

View PostCBart21, on 15 October 2009 - 02:53 PM, said:

Have you ever attempted to reinstall Windows Vista on a Windows/Linux dual boot only to find yourself only booting into windows? I recently did! How frustrating! I finally found out how exactly to go about fixing the problem. If you ever find yourself in this situation, I hope these next steps will get you to where you need to be.

NOTE: I am using Windows Vista / Kubuntu 9.04 Dual Boot in this example.

The first thing you need to do is find a Live CD you can boot into. This can be just about any Live CD, but for optimum results use one that shares the same Linux distribution that you use. Boot into this CD and open up a prompt.

The next thing you have to do is find out what device your Linux partition is running on. This can easily be accomplished using the following commands:

fdisk /dev/xxx


xxx is equal to any of the following directly from fdisk(8) man pages:

(/dev/hd[a-h] for IDE disks, /dev/sd[a-p] for SCSI disks, /dev/ed[a-d] for ESDI disks, /dev/xd[ab] for XT disks)

You will be given a list of options and a prompt to type in your choice. Use the choice 'p' to print your partition table and hit "Enter".

The table will be printed to the screen in which you can deduce which device your Bootable Linux Partition resides in. Once you figure out the device, make a note of the device string. Mine is: "/dev/sda5"

NOTE: There will be two or more Linux Partitions on a simple partition table. One is the root partition and the other will most likely be the Linux Swap partition. Make sure you note the correct device.

Good job! Now you're ready for the meat of the process.

You will need to make a new directory to hold the mounted partition that will be your Linux partition. This will make more sense to you as we progress through the rest of the process. The command is:

sudo mkdir /mnt/system


Next, you need to mount your Linux partition to this new directory so we can access all the files on your Linux Operating System.

sudo mount /dev/xxxx /mnt/system


In my case, 'xxxx' would be 'sda5'. You're Linux partition may be different.

The next few steps involve "chroot'ing" into this new mounting partition. When you 'chroot' to a mounted device, you are literally changing the root directory of the LiveCD system to the root directory of the mounted device. What this does is it allows you to run commands directly on the Linux partition that you specify instead of running the commands on the LiveCD.

The first thing you need to do is take control of the root user.

sudo -i


You do this so you can run the 'chroot' command.

Now, you need to bind the /dev tree from the LiveCD file tree to the mounted Linux Partition using the following command:

mount -o bind /dev /mnt/system/dev


Now, chroot into our partition.

chroot /mnt/system


Finally! We are inside our Linux partition. We have one more command left. What this command does is reinstall and configure our Grub Bootloader so that we can boot into either Windows or Linux when we restart.

grub-install /dev/xxx


'xxx' refers to the three character description representing our hard-drive.

We are finally finished!

All you have to do is restart! We now have choices when we boot up our computer!


**Please note: This post is for my own reference. However, if do find yourself stuck with this little situation, I hope this helps you out!**


P.S. If you want to change the default choices in the bootloader you can edit the file "/boot/grub/menu.lst"


Thanks for reading!


--Chris

Was This Post Helpful? 0

#3 Guest_arun*


Reputation:

Posted 18 July 2010 - 08:11 PM

[quote name='arun' date='18 July 2010 - 07:09 PM' timestamp='1279508954' post='1069625']

View PostCBart21, on 15 October 2009 - 02:53 PM, said:

Have you ever attempted to reinstall Windows Vista on a Windows/Linux dual boot only to find yourself only booting into windows? I recently did! How frustrating! I finally found out how exactly to go about fixing the problem. If you ever find yourself in this situation, I hope these next steps will get you to where you need to be.

NOTE: I am using Windows Vista / Kubuntu 9.04 Dual Boot in this example.

The first thing you need to do is find a Live CD you can boot into. This can be just about any Live CD, but for optimum results use one that shares the same Linux distribution that you use. Boot into this CD and open up a prompt.

The next thing you have to do is find out what device your Linux partition is running on. This can easily be accomplished using the following commands:

fdisk /dev/xxx


xxx is equal to any of the following directly from fdisk(8) man pages:

(/dev/hd[a-h] for IDE disks, /dev/sd[a-p] for SCSI disks, /dev/ed[a-d] for ESDI disks, /dev/xd[ab] for XT disks)

You will be given a list of options and a prompt to type in your choice. Use the choice 'p' to print your partition table and hit "Enter".

The table will be printed to the screen in which you can deduce which device your Bootable Linux Partition resides in. Once you figure out the device, make a note of the device string. Mine is: "/dev/sda5"

NOTE: There will be two or more Linux Partitions on a simple partition table. One is the root partition and the other will most likely be the Linux Swap partition. Make sure you note the correct device.

Good job! Now you're ready for the meat of the process.

You will need to make a new directory to hold the mounted partition that will be your Linux partition. This will make more sense to you as we progress through the rest of the process. The command is:

sudo mkdir /mnt/system


Next, you need to mount your Linux partition to this new directory so we can access all the files on your Linux Operating System.

sudo mount /dev/xxxx /mnt/system


In my case, 'xxxx' would be 'sda5'. You're Linux partition may be different.

The next few steps involve "chroot'ing" into this new mounting partition. When you 'chroot' to a mounted device, you are literally changing the root directory of the LiveCD system to the root directory of the mounted device. What this does is it allows you to run commands directly on the Linux partition that you specify instead of running the commands on the LiveCD.

The first thing you need to do is take control of the root user.

sudo -i


You do this so you can run the 'chroot' command.

Now, you need to bind the /dev tree from the LiveCD file tree to the mounted Linux Partition using the following command:

mount -o bind /dev /mnt/system/dev


Now, chroot into our partition.

chroot /mnt/system


Finally! We are inside our Linux partition. We have one more command left. What this command does is reinstall and configure our Grub Bootloader so that we can boot into either Windows or Linux when we restart.

grub-install /dev/xxx


'xxx' refers to the three character description representing our hard-drive.

We are finally finished!

All you have to do is restart! We now have choices when we boot up our computer!


**Please note: This post is for my own reference. However, if do find yourself stuck with this little situation, I hope this helps you out!**


P.S. If you want to change the default choices in the bootloader you can edit the file "/boot/grub/menu.lst"


Thanks for reading!


--Chris

After long time i found a solution for my problem here which is very simple. Thank you Chris.
Was This Post Helpful? 0

#4 bocaccio  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 93
  • Joined: 06-May 10

Posted 25 July 2010 - 09:53 PM

[quote name='arun' date='18 July 2010 - 07:11 PM' timestamp='1279509098' post='1069628']

View Postarun, on 18 July 2010 - 07:09 PM, said:

View PostCBart21, on 15 October 2009 - 02:53 PM, said:

Have you ever attempted to reinstall Windows Vista on a Windows/Linux dual boot only to find yourself only booting into windows? I recently did! How frustrating! I finally found out how exactly to go about fixing the problem. If you ever find yourself in this situation, I hope these next steps will get you to where you need to be.

NOTE: I am using Windows Vista / Kubuntu 9.04 Dual Boot in this example.

The first thing you need to do is find a Live CD you can boot into. This can be just about any Live CD, but for optimum results use one that shares the same Linux distribution that you use. Boot into this CD and open up a prompt.

The next thing you have to do is find out what device your Linux partition is running on. This can easily be accomplished using the following commands:

fdisk /dev/xxx


xxx is equal to any of the following directly from fdisk(8) man pages:

(/dev/hd[a-h] for IDE disks, /dev/sd[a-p] for SCSI disks, /dev/ed[a-d] for ESDI disks, /dev/xd[ab] for XT disks)

You will be given a list of options and a prompt to type in your choice. Use the choice 'p' to print your partition table and hit "Enter".

The table will be printed to the screen in which you can deduce which device your Bootable Linux Partition resides in. Once you figure out the device, make a note of the device string. Mine is: "/dev/sda5"

NOTE: There will be two or more Linux Partitions on a simple partition table. One is the root partition and the other will most likely be the Linux Swap partition. Make sure you note the correct device.

Good job! Now you're ready for the meat of the process.

You will need to make a new directory to hold the mounted partition that will be your Linux partition. This will make more sense to you as we progress through the rest of the process. The command is:

sudo mkdir /mnt/system


Next, you need to mount your Linux partition to this new directory so we can access all the files on your Linux Operating System.

sudo mount /dev/xxxx /mnt/system


In my case, 'xxxx' would be 'sda5'. You're Linux partition may be different.

The next few steps involve "chroot'ing" into this new mounting partition. When you 'chroot' to a mounted device, you are literally changing the root directory of the LiveCD system to the root directory of the mounted device. What this does is it allows you to run commands directly on the Linux partition that you specify instead of running the commands on the LiveCD.

The first thing you need to do is take control of the root user.

sudo -i


You do this so you can run the 'chroot' command.

Now, you need to bind the /dev tree from the LiveCD file tree to the mounted Linux Partition using the following command:

mount -o bind /dev /mnt/system/dev


Now, chroot into our partition.

chroot /mnt/system


Finally! We are inside our Linux partition. We have one more command left. What this command does is reinstall and configure our Grub Bootloader so that we can boot into either Windows or Linux when we restart.

grub-install /dev/xxx


'xxx' refers to the three character description representing our hard-drive.

We are finally finished!

All you have to do is restart! We now have choices when we boot up our computer!


**Please note: This post is for my own reference. However, if do find yourself stuck with this little situation, I hope this helps you out!**


P.S. If you want to change the default choices in the bootloader you can edit the file "/boot/grub/menu.lst"


Thanks for reading!


--Chris

After long time i found a solution for my problem here which is very simple. Thank you Chris.








I think i hit the jackpot!!! I am about to uninstall 7 from my netbook and put xp on it and I also have Ubuntu Netbook Remix and do not want to reinstall it. So thanks I think I'll use this in a day or so if 7 don't stop acting up. I can get online on ubuntu but not 7. Crazy huh.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1