Help - Search - Members - Calendar
Full Version: Help! Windows Re-ordered My Partitions!
Linuxhelp > Support > Technical Support
I had Windows and Red Hat Linux set to dual boot just fine. But I had some extra space that I created a FAT32 partition on in Windows so that I could share files between the OSs. But after I added them the partitions have gotten switched around! What I mean is, they're still there, but now my /boot partition, which used to be /dev/hda2 is now /dev/hda1! And my Windows boot drive went from /dev/hda1 to /dev/hda2. I think my other partitions got changed around too. What do I do? sad.gif

I can mount the file systems just fine when I boot off the linux CD and go into rescue mode, but I can't figure out how to fix this sad.gif
A little more info... it also screwed up XP because XP was set to boot off of partition(1) and it was now located on partition(2). I was able to change the boot.ini file on the drive to refer to partition(2) now and so I now have XP back. So now I just need to figure out how to tell Linux where all my partitions are again. blink.gif

Can anybody help me with that?
OK .... first you need to figure out which partitions are which ....

Boot off the rescue disk:

linux resuce

then exit to the console prompt ... create a mount point:

mkdir /mnt/rh

Figure out what partition is where use the command:

fdisk -l /dev/hda

You need to know what partition is root, and boot, and swap, and windows boot.

Then mount the / (that is the root) partiton into /mnt/rh (i'll assume boot is hda1, windows boot is hda2, swap is hda3 and root is hda5 ... change the instructions below based on what you actually find....)

mount /dev/hda5 /mnt/rh

now mount your boot partiton into the linux root partition ...

mount /dev/hda1 /mnt/rh/boot

if everything is mounted, chroot into the linux install so we can fix grub...

chroot /mnt/rh /bin/bash

now go to /boot/grub

cd /boot/grub

and edit menu.lst

vi menu.lst (or another console text editor of you choice)

change all the drives to the correct values in menu.lst ... for grub purposes ... hda1 is (hd0,0), hda2 is (hd0,1), hda3 is (hd0,2), hdb1 is (hd1,0), hdb2 is (hd1,1), etc.

Once that is set properly, run grub and reset everything up...


now you are at the grub prompt ....

root (hd0,0)
(note: this is if your boot partiton is hda1)

setup (hd0)
(this would be to set the MBR to boot from grub)


If all the paths are correct in /boot/grub/menu.lst and the grub commands completed without error, you should be able to exit the the chroot and reboot the PC...
Thanks for the help! I'm going to try this now. However, I don't want to install GRUB into the MBR. The way I set it up before is I installed it into the first sector of the /boot partition and then used dd to dump the first sector of the HD to a floppy disk. Then booted into windows, but the binary file on my C: drive and added C:linux.bin="Linux" to my list of OS's. So I'm assuming instead of setup(hd0) I do setup(hd0,0)?
Well, everything has worked so far, except for setup. I don't want to put it into the MBR. So how do I install it to the first sector of the boot partition?
I'm posting this from Linux! Woooo! cool.gif biggrin.gif

Thanks for the help!

I figured out how to install grub into the partition (grub-install /dev/hda1) and then I just re-did the dd process and copying the sector over to Windows. Thanks again!

Talk about a crash course in grub. blink.gif
The setup (hd0,0) would have worked for the setup (grub-install /dev/hda1 does the same thing)... you still would have have needed to either copy the sector over to the windows drive ... OR use bootpart (instructions).
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.