What is the maximum number of partitions on a SCSI disk?

I got this question by email from some guy I dont know in South Africa. Why, and why me? No idea. Anyway, I was not completely sure about the answer, so I looked it up, and added some extra info as well. Seems like a good excuse for a blog post as anything.

What is the maximum number of partitions on a SCSI disk?

The short answer: 16

The long answer: 255
Supposing the question is about Linux systems. Linux uses the same disk partition layout as Windows, and they both adopted it from MSDOS. Thus, under Linux a hard disk can have only 4 primary partitions. To extend this, one of the primary partition can be marked as an extended partition containing logical partitions. The total number of adressable primary and logical partitions in Linux on a scsi disk is 16. This is because of the flat device number addressing scheme that is used for devices. Device major number 8 is a SCSI disk block device, and the first 16 minor numbers are reserved for adressing partitions on the first disk, the next 16 for the second and so forth.

Note that there is probably no problem to add a lot more of logical partitions to a SCSI disk. I think the original extended container specification has a limit of 255 partitions, and Linux has a built-in maximum that matches this. I think modern Windows systems can address about 128 partitions, with some of them reserved for special use. Perhaps is the scheme even extended today.

On Linux it may be difficult to address more than the first 16 partitions on a SCSI disk, as the rest will not be available through the normal device node interface.

The tough solution: Use kpartx and the device mapper.
kpartx (part of multipath-tools) can map any number of available partitions to userspace via the device mapper. Test and use with care.

The easy solution: Use LVM instead.
If one needs more logical entities for storage on one disk, it is probably easier to use logical volume management (LVM). With LVM you can format a partition (or even a whole disk) as a “PV” (man pvcreate), and then put that PV in a Volume Group (VG) (man vgcreate). From a Volume Group, you can create Logical Volumes (man lvcreate), which can be formatted as a normal filsystem and mounted the same way as a hard disk partition. You can also add more than one PV to a Volume Group, making it easy to extend volumes later (man vgextend, man lvextend).

Good luck to the guy from South Africa.

One Response to “What is the maximum number of partitions on a SCSI disk?”

  1. Muito bom artigo . Eu absolutamente apreciar este
    site. Continue assim !

Leave a Reply