* reorder partition numbering
Posted on February 26th, 2009 by Alex. Filed under Linux.
If you move partitions, change their sizes and create new ones, the numbering might get mixed up (e.g. with gparted). The partitions might look like these:
/dev/sda1 ntfs /media/win
/dev/sda2 ext4 /
/dev/sda3 ext3 /boot
/dev/sda4 extended
/dev/sda8 linux-swap
/dev/sda6 fat32 /media/programs
/dev/sda7 fat32 /media/testdisk
/dev/sda5 fat32 /media/stuff
If you want to reorder the partition numbering for whatever reason, fdisk will help. Execute fdisk /dev/sda (as you can see, I want to reorder the numbering of my first SCSI disk) after becoming root.
jitu:/usr/src/linux# fdisk /dev/sda
The number of cylinders for this disk is set to 19457.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)Command (m for help):
If m is entered at the prompt, the possible commands will be listed. Type x to activate the extra functionality (experts only). Press m again to see new expert options. Enter f (fix partition order) and w to write the changes to the disk and exit.
After changing the sequence, it might be necessary to reboot, since the drive could be in use. Before rebooting, you need to check (and change) the mounting options in /etc/fstab and the root= parameter for the kernel in /boot/grub/menu.lst. Otherwise you might ending up with a broken system. It is also a very good idea to make backups of valuable data, before trying out fdisk.
January 16th, 2010 at 12:23 am
Thanks for posting this! I just reordered some partitions, and didn’t like the idea of the sequence numbers not matching the partition order.
[REPLY]
February 4th, 2010 at 7:07 pm
Thanks for the tip! I have a linux install on a flash drive with a fat32 partition. Because I had created the linux partition first, but at the end of the drive, the partitions were out of order. This caused windows xp to not be able to read the fat32 partition (linux was fine). After the reorder, everything is working now.
[REPLY]