Click to See Complete Forum and Search --> : How to get over 200 partitions from an IDE hard disk in Linux


saikee
12-12-2005, 11:20 AM
One line summary

Create as many logical partitions as you can then hide this extended partition to become one "unknow" primary partition - then repeat the same 3 times

This is strictly according to Linux rules.

Actually I couldn't find the rules but in the Internet a maximum 63 and 15 partitions have been said for an IDE and a Sata/SCSI disk respectively.

In fact what I have found out, by trial and error, is that the highest partition number is 63. This is achieved by having only one extended partition hda1 with logical partitions from hda5 to hda63.

As soon as one primary partition is created the 63 will drop back to 62. Thus a user has 3 primaries can end up with no more than hda60. As an extended partition is in name only and so we can have a maximum 59 usuable partitions in an IDE disk, whichever way you cut the disk up.

However in PC standard a digit "1" is added to a partition to denote it as hidden. Thus Fat16, Fat32, Windows Extended and NTFS partition types are 6, b, f and 7 respectively but they become hidden with ID 16, 1b, 1f and 17.

In Linux the straight extended partition has ID 5. One can hid the extended partition too, making it become a primary partition unknow to the operating systems include Linux, having the ID changed to 15. The partition ID is just one byte entry in the 16-byte partition table. The change does nothing to the partition interior.

I discovered this by using the Grub floppy, as it got a "hide" command as part of the tools available.

Therefore I could start with cfdisk program to create hda5 to hda63 for a new hard disk. Linux automatically assigns hda1, with ID 5, as the extended partition to cover this first set of 59 logical partitions. The logical partitions are type 83 and all are unformatted.

I then rebooted to ensure the partition table was written but with a Grub floppy in the drive to boot to a Grub prompt. This command

hide (hd0,0)

turns hda1 ID to 15 and the first lot of logical partitions disappears, with hda1 left as an unknown "parimary" partition.

I then proceeded to create my second lot of hda5 to hda62 because hda1 was already present. Linux automatically assigns hda2 as the extended partition to cover my second lot of logical partitions. I then repeated what I did before by hiding the second partition with

hide (hd0,1)

and then repeated the exercise again to get the third lot of logical partitions created from hda5 to hda61, covered by hda3. I proceeded to hide hda3 agian with

hide (hd0,2)

Similarly I ended up with hda5 to hda60 when hda4 was marked as the extended partitions.

When I hid my last hda4 the disk showed up 4 primary partitions type ID 15 and marked as "unknow" to Grub.

I used a 30 Gb hard disk with only 100Mb per logical partition and ended up with still empty space after over 240 partitions.

To test the set up I installed Troppix 1.2 in hda60 of hda4, deliberately created to a 5Gb size, while hda1, hda2 and hda3 were hidden. I put Troppix's Grub in MBR to boot to partition hda60 or (hd0,59).

I then rebooted to a Grub floppy, hid the hda4 and unhid hda3 to get the 3rd set of logical partitions into the open. I then booted up Troppix Live CD, used it to format hda60 (belonging to hda3). Troppix has Grub so I installed Grub on its own in hda60 partition with a empty menu.lst displaying "This is hda3" when booted.

Quite rightly I got the above message.

I then hid hda3 and unhid hda2 to repeat the same procedure so as to prove the partitions are indeed usable.

I have different mesages for different partitions of hda1, hda2 hda3 and hda4, using Grub booting to the same partition reference. The hda60 was in different locations in the 4 cases but that doesn't matter as Grub only fetches the menu.lst in each case for execution.

I notice the early hda61 to hda63 disappeared in the cfdisk and fdisk program as I progressed from hda1 to hda4 but I know at least hda60 is available in each of hda1 to hda4 because I was booting it in each extended partition.

I am not suggesting this is a prpoper method to get 240 partitions out of an IDE disk. It is just a demonstration of what we could use a hard disk according to its known characteristic. The hiding and unhiding is commonly used by Grub for booting several versions of M$ systems in the same box. I can't confirm the consequence of inadvertently unhiding more than one lot of logical partitions at a time but if the disk is readable it is quite simple to reconstruct the partition again. I had my 60-partition disk partition table rebuilt about half of a dozen times and suffered vitually no data loss.

I am typing this post with Troppix installed at the hda60 partition belonging to the hda4.

---------------------------------------------

I doubt if the about 240-partition disk has much appplication but hiding one partition from another does have it place. It is what I am doing in one disk installed with 3 BSDs and one Solaris. These systems use internal slices similar to the logical partitions in an extended partition. The co-existance of them with my Linux has resulted repeated corruption of the partition table. They appear co-existing with each other fine if when one is booted while the other 3 are temporarily hidden.