Home > Uncategorized > Re-ordering Hard Drive Partitions

Re-ordering Hard Drive Partitions

October 16th, 2005

I’ve been getting more and more annoyed with my Windows box recently… it keeps on crashing and is just going slower and slower. Over the last couple of weeks I’ve noticed that none of the work I do is specifically for Windows… most of it is on servers, so I decided to install Linux on there.

Friday evening I took my machine home, resized my main windows partition and created a load of extra partitions. The partitions under Linux are numbered in the order created, not the order they exist on the hard drive. So my partitions were not in the following order on the disk…

  1. 30Mb Boot Partition – /dev/hda2
  2. 25GB Windows Partition – /dev/hda1
  3. 1GB Swap Partition – /dev/hda3
  4. 10GB Root Partition – /dev/hda4
  5. 14GB Shared (FAT32) Partition – /dev/hda5

Now being the really anal guy I am I wanted my partitions to be numbered as they exist on the hard drive… basically I wanted /boot to be hda1 and windows to be hda2. So I booted up a gentoo live CD, ran fdisk on the disk and used the f command (under advanced options) to re-order the disks… Excellent nice and simple… or not…

Next time I tried to boot windows up Windows came up with some helpful error message saying it couldn’t find some dll or something… After a couple of seconds of crapping my pants… convinced I’d just destroyed my windows partition and was going to have to re-install windows I thought about why this had happened…

It all comes down to the boot.ini file. This file is hidden in the system root (usually c:) and looks something like this…

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=”Microsoft Windows XP Professional” /noexecute=optin /fastdetect

The important part is the partition(1) section… for some reason partitions are indexed from 1 unlike the rest of the items which are indexed from 0. All I had to do was change that to partition(2) (as it was hda2) and Windows started booting fine…

Hopefully this information will be useful if anyone else has the same problem.

Be Sociable, Share!
Tags: ,
Comments are closed.