improving device file creation - (MAKEDEV-2.5)

Richard Gollub rgollub at
Tue Jan 16 08:27:50 PST 2001

Fabio Fracassi wrote:
> On Tuesday 16 January 2001 13:30, you wrote:
> >       Judging from the range of values for "minor" (which I observe in the
> > document) it appears to me that this variable has a length of 8 bits
> > (allowing values 0-255), and, therefore 255 is the logical limit for any
> > partitioning scheme. As the "real" limit is quite lower, the explanation
> > must come from other considerations (e.g., hardware) or conventions.
> That is not exactly true, the restrictions in the Number of Partitions is
> caused by the simple fact, that two (ide) or more (scsi) devices share the
> same Major number. for example hda and hdb have both major number 3
> hda starts with minor number 0, hdb with 64.

	Let's see if I can rephrase my reasoning to make it clearer. Your
comment just confirms the fact that other considerations come into play.

	Let's take SCSI devices as example:

	device		major minor 	partitions 1-15
					associated minors 
	/dev/sda	    8	  0	1 thru 15
	/dev/sdb	    8	 16	17 thru 31
	/dev/sdc	    8	 32	33 thru 47
	/dev/sdd	    8	 48	49 thru 63
	/dev/sde	    8	 64	...
	/dev/sdf	    8	 80	and so on		
	/dev/sdg	    8	 96	and so forth
	/dev/sdh	    8	112
	/dev/sdi	    8	128
	/dev/sdj	    8	144
	/dev/sdk	    8	160
	/dev/sdl	    8	176
	/dev/sdm	    8	192
	/dev/sdn	    8	208
	/dev/sdo	    8	224	...
	/dev/sdp	    8	240	241 thru 255
	Thus out of 256 possibilities for minor, one has 16 mapped to whole
disks and the remaining 240  for each of one out of the 15 partitions
allowed per whole disk (i.e, 16 devices * 15 partitions/device).

	Cleary minor has (at least) 8 bits, in order to store values up to 255.
But as real devices are limited to a lower number of total partitions
per device in the partition table, this limitation must arise due to
other factors.

	From the logical point of view, the partition table (PT) is limited
only by its total space allocation. Given a max size for the PT in a
given hardware, it can contain as many partitions as consistent with
that space. Thus, assuming that the mapping contained in the pair
(major,minor) in devices.txt reflects _all_ the conventions and hardware
constraints applicable to disk devices (as they were created/engineered
through time), there must be a good reason to have for instance:

	IDE drives: total of 63 partitions (up to 4 of type 'primary', or 3
primaries plus 1 extended; and up to 59 logical partitions per extended

	SCSI drives: total of 15 partitions (structured like IDE in view of
statement in devices.txt to the effect that "partitions are handled in
the same way as for IDE disks...", that I understand to mean up to 4
primary partitions or 3 primaries and 1 extended, capable of holding up
to 11 logical partitions).

	Given that the PT structure (software-wise) is independent whether the
hardware is this or that, the Number of Partitions must depend on space
(at prima facie) or hardware-independent external conventions.

	Hope hot to have confused even more the issue... :-)


Unsubscribe: send email to lfs-discuss-request at
and put unsubscribe in the subject header of the message

More information about the lfs-dev mailing list