[parted-devel] Partition renumbering after a remove

Curtis Gedak gedakc at gmail.com
Fri May 22 17:24:55 UTC 2009


Joel Granados wrote:
> On Thu, May 21, 2009 at 09:36:41AM -0600, Curtis Gedak wrote:
>   
>> Joel Granados wrote:
>>     
>>> Hello list.
>>>
>>> The question is: why does parted call renumber partition funcion every
>>> time it removes/deletes a partition?
>>>       
>> Hi Joel,
>>
>> Perhaps it has something to do with MSDOS partition tables and logical  
>> partitions?
>>
>> When a logical partition is deleted, it affects the partition numbers of  
>> each logical partition that follow in the chain.
>>
>> For example, an extended partition contains four logical partitions A,  
>> B, C, and D. These logical partitions are accessed by the operating  
>> system as follows:
>>
>>    *  Partition A as /dev/sda5.
>>    *  Partition B as /dev/sda6.
>>    *  Partition C as /dev/sda7.
>>    *  Partition D as /dev/sda8.
>>
>> If partition B is deleted, then the remaining logical partitions will be  
>> accessed by the operating system as follows:
>>     
>
> Yes, but this is due to parted renumbering.  That is, if parted did not
> renumber the partitions, the OS would access the partitions as sda5 sda7
> sda8.
>
>   

I agree that the OS might continue to access the partitions as sda5 sda7 
sda8.  However this would only last until the next reboot of the system 
when the partitions would be assigned sequential numbers with no gaps.

The following article provides a good explanation of how the chains work 
with Extended Boot Records and logical partitions:
http://en.wikipedia.org/wiki/Extended_boot_record

I believe that this physical chaining of one logical partition to the 
next dictates the partition number assigned to each logical partition.

Please note that using fdisk to delete a logical partition produces the 
same renumbering result - the logical partitions after the deleted 
logical partition are renumbered.

I suspect this behaviour has to do with the nature of chaining one 
logical partition to another within an extended partition.


If parted were to ignore the partition renumbering, then all might be 
fine while the system is up and running.  However, on a reboot the OS 
would assign sequential numbers to the logical partitions and there 
would be no gap in the numbers.

If a user were to make system changes, such as updating /etc/fstab, 
based on partition numbers that were not renumbered by parted, then 
these changes could be incorrect upon a subsequent system reboot.

Does that make sense?  :-)

I apologize in advance if we are talking about two different things.  A 
while back I had started investigating the parted code.  However, when 
the requirements to compile the code changed to require updated tools 
not packaged by my distribution, I ceased the endeavour.

>>    *  Partition A as /dev/sda5.
>>    *  Partition C as /dev/sda6. Note the change in device name.
>>    *  Partition D as /dev/sda7. Note the change in device name.
>>
>> This is just a guess since I haven't looked into the renumber partition  
>> function.  :-)
>>
>> Regards,
>> Curtis Gedak
>>     



More information about the parted-devel mailing list