Hello Curtis: You are correct my friend :) That link you gave me made me realize the reason why the logical partitions need to be in order. Your timing could not be better as I was playing with the idea of changing parted for fedora.
More comments bellow. On Fri, May 22, 2009 at 11:24:55AM -0600, Curtis Gedak wrote: > 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. Actually my test patch only worked for primary partitions. When I tried to do the same to logical partitions, parted could not handle it internaly. However, what is possible and survives reboots is to have the logical partitions numbers in disorder. Like this: <snip> sda6 6G-7G sda7 5G-6G sda8 7G-8G <snip> This is possible because of the linked list kind structure that manages the logical partitions. To the kernel and to parted its just a linked list where sda7 is first, then sda6 then sda8. Actually, if you get your partition table to this state parted will order the partitions considering the start-end numbers and fdisk will order them considering the mayor minor number (And they are both correct IMO). > > 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 Thx for this, Much appreciated. ^^^^^^^^^^^ > > I believe that this physical chaining of one logical partition to the > next dictates the partition number assigned to each logical partition. To my knowledge there is no way to assign the part number in the extended partition table. One can do it in the primary partition table, look at this thread form fedora installer: https://www.redhat.com/archives/anaconda-devel-list/2009-May/msg00284.html But for the logical partitions the numbers will be asigned in order of the linked list. > > 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. expected > > I suspect this behaviour has to do with the nature of chaining one > logical partition to another within an extended partition. not sure about this. I'm more inclined with the linked list approach. Can you expand more on this. > > > 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. I think we were talking about the same thing. Regards. > >>> * 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 >>> > > _______________________________________________ > parted-devel mailing list > [email protected] > http://lists.alioth.debian.org/mailman/listinfo/parted-devel -- Joel Andres Granados Brno, Czech Republic, Red Hat. _______________________________________________ parted-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/parted-devel

