LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Rearranging Partitions (https://www.linuxquestions.org/questions/linux-software-2/rearranging-partitions-470162/)

norain 08-02-2006 01:46 PM

Rearranging Partitions
 
So to make a ridiculously long story short... my partitions are out of order due to changes made in Grub... and the MBR on my Linux drive can no longer be recognized by windows. What happened was.

Device Boot Start End Blocks Id System
/dev/hda1 2 24792 199133707+ f W95 Ext'd (LBA)
/dev/hda5 2484 3758 10241406 b W95 FAT32
/dev/hda6 3759 24792 168955573+ 7 HPFS/NTFS
/dev/hda7 * 2 14 104359+ 83 Linux
/dev/hda8 15 2483 19832211 8e Linux LVM

became

Disk /dev/hda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 2 24792 199133707+ f W95 Ext'd (LBA)
/dev/hda5 2484 3758 10241406 b W95 FAT32
/dev/hda6 * 2 14 104359+ 83 Linux
/dev/hda7 15 2483 19832211 8e Linux LVM
/dev/hda8 3759 24792 168955573+ 7 HPFS/NTFS

and is now...

Device Boot Start End Blocks Id System
/dev/hda1 2 24792 199133707+ f W95 Ext'd (LBA)
/dev/hda5 * 2 14 104359+ 83 Linux
/dev/hda6 15 2483 19832211 8e Linux LVM
/dev/hda7 3759 24792 168955573+ 7 HPFS/NTFS
/dev/hda8 2484 3758 10241406 b W95 FAT32
-------------------------------------------------

My question is what would be the simplest method of putting the partitions back in order? As you can see they're all maintained their proper sizes and are just in the wrong order. All the data is perfectly safe and I have no problem getting back into linux. All I need to do is rearrange them.

Advice?

pixellany 08-02-2006 02:15 PM

I am afraid you will need to make the story LONGER. There is some key info missing---ie what exactly you did to get where you are.

Note the following:
1. GRUB does not change partition numbers or location.
2. Windows is not supposed to "recognize the mbr on the linux drive". When the computer boots, it goes to the mbr first, and then to the code the actually boots one of the OSes. Once you are up and running, you no longer care about the mbr. (I suspect you menat to say something else here)
3. If the system works, the order of the partitions does not matter.

We need more info about exactly what changes you have made.

norain 08-02-2006 03:10 PM

Alright. Long version it is.

Linux is installed on HD1 (windows was already installed on HD2 I just unplugged that drive and installed Linux). With Linux up and running I tried to get grub to boot my Windows drive with both XP and 2003 Server on it.

First I ran:
unhide (hd1,0)
hide (hd1,4)
rootnoverify (hd1,0)
map (hd0) (hd1)
map (hd1) (hd0)
makeactive
chainloader +1

Didn't work. So someone suggested:

map (hd0) (hd1)
map (hd1) (hd0)
unhide (hd1,0)
hide (hd1,4)
rootnoverify (hd1,0)
makeactive
chainloader +1

Placing the map command before the hide command meant that I accidentally hid the LINUX hd0,4 instead on the one on hd1,4 (the windows drive. So this moved everything up one:

Before
Device Boot Start End Blocks Id System
/dev/hda1 2 24792 199133707+ f W95 Ext'd (LBA)
/dev/hda5 2484 3758 10241406 b W95 FAT32
/dev/hda6 3759 24792 168955573+ 7 HPFS/NTFS
/dev/hda7 * 2 14 104359+ 83 Linux
/dev/hda8 15 2483 19832211 8e Linux LVM

After...
Device Boot Start End Blocks Id System
/dev/hda1 2 24792 199133707+ f W95 Ext'd (LBA)
/dev/hda5 2484 3758 10241406 b W95 FAT32
/dev/hda6 * 2 14 104359+ 83 Linux
/dev/hda7 15 2483 19832211 8e Linux LVM
/dev/hda8 3759 24792 168955573+ 7 HPFS/NTFS

Crazy but true. The NTFS partition went to the bottom andeverything above it got bumped up one. I had to switch the boot partition from hd0,6 to hd0,5 to get back into linux, and somehow in the process Windows stopped recognizing the NTFS partition.

I forget what change caused FAT32 to be under NTFS, but Windows still sees the FAT32 drive just fine. But I have a feeling that NTFS needs to be back in it's original position for it to work.

Now how it is that, with hd0,4 hidden Grub or Linux decided to move everything up one is beyond me. but that's the weird kinda situation I'm in. All I have to do is change the positions of the partitions. There must be a way to do it seeing as I've already accidentally done it twice. If I can do that I can use my critical data on NTFS and go on a happy man. Otherwise I'd have to boot to Knoppix or something and copy everything off onto the FAT32 drive which may or may not be able to hold the NTFS files... You get the picture.

So that's it. Same question: How can I rearrange the partition?

gkiagia 08-02-2006 03:37 PM

!!!! :confused: :scratch: That's really strange.

My opinion is that you should not hide any partition. I have a winxp-win98-linux machine with all partitions visible and both winxp and win98 can access all the partitions (except those with reiserfs and swap).

What I noticed is that the partition table was already messed up before you try that. For example, hda7 should be hda5 as it starts from sector 2.

Somebody recently pointed me to an utility that tries to guess the correct partition table and fix it. I will give you the link. http://www.linuxquestions.org/questi...49#post2346349
Try the first three tools that he mentions.


All times are GMT -5. The time now is 05:06 PM.