当 Linux 驱动器字母用完时会发生什么?

当 Linux 驱动器字母用完时会发生什么?

假设我有 50 个 USB 闪存驱动器。

我想他们一定会/dev/sda/dev/sdz。之后会发生什么/dev/sdz

答案1

它将转到/dev/sdaa/dev/sdab/dev/sdac等。

这是源代码中的注释:

/**
 *  sd_format_disk_name - format disk name
 *  @prefix: name prefix - ie. "sd" for SCSI disks
 *  @index: index of the disk to format name for
 *  @buf: output buffer
 *  @buflen: length of the output buffer
 *
 *  SCSI disk names starts at sda.  The 26th device is sdz and the
 *  27th is sdaa.  The last one for two lettered suffix is sdzz
 *  which is followed by sdaaa.
 *
 *  This is basically 26 base counting with one extra 'nil' entry
 *  at the beginning from the second digit on and can be
 *  determined using similar method as 26 base conversion with the
 *  index shifted -1 after each digit is computed.
 *
 *  CONTEXT:
 *  Don't care.
 *
 *  RETURNS:
 *  0 on success, -errno on failure.
 */

https://github.com/torvalds/linux/blob/master/drivers/scsi/sd.c#L3303-L3324

相关内容