在linux上,对于IDE硬盘来说,分区个数限制在63个;而对于SCSI硬盘限制在15个。
我们可以直接在linux内核源代码中找到证据:
include/linux/ide.h
#define PARTN_BITS 6 /* number of minor dev bits for partitions */
次设备号也就决定了可挂载的IDE设备不会超过63个(2^6-1,之所以减一是因为hdX本身也会占用一个)。
SCSI也差不多,见 drivers/scsi/sd.c
#if !defined(CONFIG_DEBUG_BLOCK_EXT_DEVT)
#define SD_MINORS 16
#else
#define SD_MINORS 0
#endif
在内核文档中也可以看到,见Documentation/devices.txt :
For partitions, add to the whole disk device number:
0 = /dev/hd? Whole disk
1 = /dev/hd?1 First partition
2 = /dev/hd?2 Second partition
…
63 = /dev/hd?63 63rd partition
…
8 block SCSI disk devices (0-15)
Partitions are handled in the same way as for IDE
disks (see major number 3) except that the limit on
partitions is 15.