[ubuntu-uk] how to change hdd/partition numbering

Vitorio Okio ovitorio at hotmail.com
Thu Jan 24 01:44:29 GMT 2008


On Wed, 23 Jan 2008 16:08:14 +0000, Tom Bamford wrote:

> Vitorio Okio wrote:
>> I've deleted with GParted unwanted Dell Utility partition sited the
>> first on my HDD.  This partition was set as /dev/sda1, so all others
>> followed correspondignly: /dev/sda2, /dev/sda3, etc.
>>
>> Now after deleting and booting back in Ubuntu my now first partition is
>> still marked as /dev/sda2. And all others follow.
>>
>> How can I change this?  I would like my first partition being set /dev/
>> sda1, etc.?
>>
>> Thank you
> Hi,
> 
> You can renumber your partitions but you'll need a live CD to do it
> with. Assuming you have either backed up your entire system or you don't
> care if you nuke it by accident or by means of a power cut - boot off
> the live cd, then run (in a terminal window)
> 
> sudo fdisk /dev/sda
> 
> 
> Press x to go into the fdisk advanced menu, then press f to fix the
> partition order. You'll need to update your grub configuration, so mount
> your /boot (or /) partition in a temporary location and locate your
> system's /boot/grub/menu.lst file. Update any partition references in
> the notation "hd(0,1)" - the second number may have to be knocked down
> one to reflect the new order.
> 
> I would also check to see if any of your partition UUIDs have changed as
> a result of renumbering them. Open your grub menu file in one window and
> a terminal in the other. Run this command in the terminal
> 
> ls -l /dev/disk/by-uuid
> 
> to list your partition UUIDs and manuall inspect your grub file to make
> sure they match up. Make any corrections where necessary, making sure
> the line "root=UUID=1234567890" parameter is correct on any line
> beginning with the word "kernel". Once done, save the menu file, unmount
> your partitions and reboot your system. Hopefully it will boot, if not
> then note down any errors and reboot into the live CD.
> 

Unfortunately it did not worked. Here is the actual output of my try.

At the first run fdisk reported "partitions out of order" after printing 
the partition table.  Then after applying 'x' and 'f' it reported that 
partition order was successfully changed. 

In reality though it left the partition table untouched. And it starts 
from sda2, etc. as before the "fix".  The only difference is that fdisk 
is now happy :-) and does not report "partitions are out of order" 
anymore. 

I am aware of another way that I is described in "Linux Partition HOWTO" 
as a partition table recovery after deleting partition (and this is 
exactly my case)  It also was advised me in another newsgroup.  It is 
much harder though, since it involves the deletion of each of the 
existing partition and careful recreation of them using new ordering 
numbers but same partition data (start, end, units, etc.) from the 
existing partition table.

I'll give it try tomorrow.

The method suggested by you looked very attractive in its simplicity.  
But apparently it is to work in cases when the partition numbering is 
messed up in the middle of their sequence. At least I've learnt such an 
option exists, it can save me some trouble in the future.

Thank you.





More information about the ubuntu-uk mailing list