linux 分区 259 blkext blkext的含义

   8       78         64 sde14
   8       79    2195456 sde15
 259        0         64 sde16
 259        1      65536 sde17
 259        2      24576 sde18

几乎什么都搜不到,还是源码的信息最多

 

https://github.com/torvalds/linux/blob/master/block/genhd.c

这个文件搜到了register_blkdev(BLOCK_EXT_MAJOR, "blkext");

“通用块层磁盘驱动程序”(Generic Block Layer)

 

 

如果驱动程序提供了一个显式的主号码,它也必须提供支持的副号码的数量,这些将用于设置gendisk。否则,只需为整个设备和扩展dev_t空间中的所有分区分配设备号。

/*
	 * If the driver provides an explicit major number it also must provide
	 * the number of minors numbers supported, and those will be used to
	 * setup the gendisk.
	 * Otherwise just allocate the device numbers for both the whole device
	 * and all partitions from the extended dev_t space.
	 */
	ret = -EINVAL;
	if (disk->major) {
		if (WARN_ON(!disk->minors))
			goto out_exit_elevator;

		if (disk->minors > DISK_MAX_PARTS) {
			pr_err("block: can't allocate more than %d partitions\n",
				DISK_MAX_PARTS);
			disk->minors = DISK_MAX_PARTS;
		}
		if (disk->first_minor > MINORMASK ||
		    disk->minors > MINORMASK + 1 ||
		    disk->first_minor + disk->minors > MINORMASK + 1)
			goto out_exit_elevator;
	} else {
		if (WARN_ON(disk->minors))
			goto out_exit_elevator;

		ret = blk_alloc_ext_minor();
		if (ret < 0)
			goto out_exit_elevator;
		disk->major = BLOCK_EXT_MAJOR; // 注意这里,看起来意思是如果硬盘本身没有提供major number,就用这个blkext
		disk->first_minor = ret;
	}

 

See Documentation/admin-guide/devices.txt for the list of allocated major numbers.

https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/devices.txt

 

 

   3 block First MFM, RLL and IDE hard disk/CD-ROM interface
  0 = /dev/hdaMaster: whole disk (or CD-ROM)
64 = /dev/hdbSlave: whole disk (or CD-ROM)
 
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
 
For Linux/i386, partitions 1-4 are the primary
partitions, and 5 and above are logical partitions.
Other versions of Linux use partitioning schemes
appropriate to their respective architectures.
 
 
   8 block SCSI disk devices (0-15)
  0 = /dev/sda First SCSI disk whole disk
16 = /dev/sdb Second SCSI disk whole disk
32 = /dev/sdc Third SCSI disk whole disk
    ...
240 = /dev/sdpSixteenth SCSI disk whole disk
 
Partitions are handled in the same way as for IDE
disks (see major number 3) except that the limit on
partitions is 15.
 
 
 259 block Block Extended Major
  Used dynamically to hold additional partition minor numbers and allow large numbers of partitions per device
 
posted @ 2024-02-16 18:10  hrdom  阅读(36)  评论(0编辑  收藏  举报