Page 1 of 1

the concept of subpartition

Posted: Sun Oct 20, 2024 4:51 pm
by ITchimp
the MBR has a partition table of up to 4 partitions; at each partition there could be another MBR with 4 more partitions, this concept can nest many times... therefore I have to ask, what is the limit on how many sub-partition there could be from a device driver point of view? also there is extended partition, are those also considered sub-partition? Then how many minor device # there must be to account for all the complexity?

Re: the concept of subpartition

Posted: Sun Oct 20, 2024 10:55 pm
by Octocontrabass
ITchimp wrote: Sun Oct 20, 2024 4:51 pmat each partition there could be another MBR with 4 more partitions, this concept can nest many times...
Which OS recognizes a MBR inside a partition like that?
ITchimp wrote: Sun Oct 20, 2024 4:51 pmalso there is extended partition, are those also considered sub-partition?
No.

Re: the concept of subpartition

Posted: Mon Oct 21, 2024 8:04 am
by rdos
This once worked, but I think Linux broke it all by using an incorrect concept.

It worked by linking the four entries to a special partition type (actually, there were more than one). In the new partition entry, there could be four more links. The correct usage of these extended partitions was that the disc address was relative, while Linux considered it as absolute (or if it was the other way around), which resulted in partition hell.

Since DOS/Windows connects partitions to a drive number, I think you can assume there can be no more than 25 partitions on a disc.

Re: the concept of subpartition

Posted: Mon Oct 21, 2024 9:13 am
by iansjack
GPT allows 128 partitions (in Windows) on a disk.

https://learn.microsoft.com/en-us/windo ... windows-11

Re: the concept of subpartition

Posted: Mon Oct 21, 2024 10:28 am
by Octocontrabass
rdos wrote: Mon Oct 21, 2024 8:04 amThis once worked, but I think Linux broke it all by using an incorrect concept.
According to whom? Last I checked, Linux agrees with Windows on how to handle MBR extended partitions.

Re: the concept of subpartition

Posted: Mon Oct 21, 2024 2:34 pm
by ITchimp
when you load the OS with bootloader like lilo and grub, can the running os peek into the partitions with other OSes might resides? Or it is completely unaware of other partitions?

Re: the concept of subpartition

Posted: Mon Oct 21, 2024 3:22 pm
by Octocontrabass
ITchimp wrote: Mon Oct 21, 2024 2:34 pmwhen you load the OS with bootloader like lilo and grub,
Huh? Why does the bootloader matter?
ITchimp wrote: Mon Oct 21, 2024 2:34 pmcan the running os peek into the partitions with other OSes might resides? Or it is completely unaware of other partitions?
As long as the running OS understands the partition table, it can see the partitions. Whether it understands the contents of the partitions is another matter.

Re: the concept of subpartition

Posted: Tue Oct 22, 2024 1:02 am
by ITchimp
minix3 allows sub partitions to have boot record. That is every drive has 4 partitions, every partition can be divided into 4 sub partitions... one of the partitions have a mbr

Re: the concept of subpartition

Posted: Tue Oct 22, 2024 10:55 am
by Octocontrabass
Minix 3 subpartitions are not standard. I have no idea if anything other than Minix 3 supports them.

Re: the concept of subpartition

Posted: Wed Oct 23, 2024 12:59 am
by rdos
I think all FAT partitions will have a boot record, but it's not used. It's only the BIOS Parameter Block (BPB) that is used by filesystem drivers. Other filesystems don't have this. OTOH, it's up to the boot loader what it does with this. With MBR, I only support booting from the first partition, and the boot loader is directly after (on sector 1 to 12). Other OSes might boot other boot records too.

Re: the concept of subpartition

Posted: Wed Oct 23, 2024 1:00 am
by rdos
Octocontrabass wrote: Mon Oct 21, 2024 10:28 am
rdos wrote: Mon Oct 21, 2024 8:04 amThis once worked, but I think Linux broke it all by using an incorrect concept.
According to whom? Last I checked, Linux agrees with Windows on how to handle MBR extended partitions.
They probably fixed it now, as this was many years ago.

Re: the concept of subpartition

Posted: Wed Oct 23, 2024 9:24 am
by nullplan
I guess I'm wondering what the point of subpartitions is. In the end, the MBR offers an array of 4 partitions, and the simplified Extended Partition scheme used by Windows, Linux, and many other operating systems, allows it to be extended by a linked list. Having multiple extended partitions, each using more than one of its partition table fields, would turn this into a tree. But I know of no operating system that would do anything with this tree other than flatten it back into a list. You end up with a massively more complicated data structure that can't do anything more than what the current system can.

Re: the concept of subpartition

Posted: Wed Oct 23, 2024 10:00 am
by iansjack
When you install some BSDs as one of multiple OSs on a disk it will partition one physical partition into several subpartitions.

Re: the concept of subpartition

Posted: Fri Oct 25, 2024 5:55 pm
by BenLunt
I did a little research some time ago and found that a well-known OS documentation stated that if you use an Extended partition, there can only be one actual partition within that four-entry table, other than the Extended partition entry itself. This was to "protect" the partitions from MBRs that didn't understand Extended entries.

I wrote a little about it here.

Another thing within that post is that I wrote a small test utility. Place your MBR code in the first sector and see which partition is booted. This will test your MBR code to see if it correctly parses Extended partitions (which some may be nested). It includes source code so that you can modify the test to boot another partition to again test your MBR code.

It was a quick and dirty afternoon project to test my findings. It may or may not be useful to you.

Ben