在我的 Asus EP1501P 上安装 Ubuntu 20.04 LTS 后,我发现我的 SDCard 读卡器与我的主 SSD相关联,/dev/sda
而不是与:/dev/mmcblk0
/dev/sdb
$ sudo fdisk -l /dev/sd[ab]
Disk /dev/sda: 59,9 GiB, 64289243136 bytes, 125564928 sectors
Disk model: STORAGE DEVICE
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sda1 32768 125564927 125532160 59,9G 7 HPFS/NTFS/exFAT
Disk /dev/sdb: 465,78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 870
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3175f771
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 534527 532480 260M b W95 FAT32
/dev/sdb2 * 534528 976773119 976238592 465,5G 8e Linux LVM
$ lsblk -pf /dev/sd[ab] | grep -v VG_Samsung | column -t
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
/dev/sda
└─/dev/sda1 exfat XXXX-YYYY
/dev/sdb
├─/dev/sdb1 vfat FUTURE_EFI E81C-0DBA
└─/dev/sdb2 LVM2_member xxxxxx-yyyy-zzzzz-xxxx-yyyy-zzzz-xxxxxx
$ sudo hdparm -I /dev/sda
/dev/sda:
SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ATA device, with non-removable media
Standards:
Likely used: 1
Configuration:
Logical max current
cylinders 0 0
heads 0 0
sectors/track 0 0
--
Logical/Physical Sector size: 512 bytes
device size with M = 1024*1024: 0 MBytes
device size with M = 1000*1000: 0 MBytes
cache/buffer size = unknown
Capabilities:
IORDY not likely
Cannot perform double-word IO
R/W multiple sector transfer: not supported
DMA: not supported
PIO: pio0
$ sudo hdparm -I /dev/sdb | sed "s/Serial Number:\s.*/Serial Number: XXXXXXXXXXXXXXX/" | head
/dev/sdb:
ATA device, with non-removable media
Model Number: Samsung SSD 870 EVO 500GB
Serial Number: XXXXXXXXXXXXXXX
Firmware Revision: SVT01B6Q
Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
Used: unknown (minor revision code 0x005e)
当 SD 卡读卡器内没有 SD 卡时,更新 grub 配置时出现以下错误:
$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
Found linux image: /boot/vmlinuz-5.13.0-40-generic
Found initrd image: /boot/initrd.img-5.13.0-40-generic
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
Found linux image: /boot/vmlinuz-5.13.0-39-generic
Found initrd image: /boot/initrd.img-5.13.0-39-generic
Found linux image: /boot/vmlinuz-5.13.0-35-generic
Found initrd image: /boot/initrd.img-5.13.0-35-generic
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
done
EDIT0:SD 卡读卡器连接到 USB 总线而不是 PCI 总线:
$ lsusb | egrep -i "(sd|card).reader"
Bus 001 Device 005: ID 05e3:0727 Genesys Logic, Inc. microSD Reader/Writer
$ lsusb -d 05e3:0727 -v | egrep -i "(sd|card).reader|idVendor|idProduct"
Couldn't open device, some information will be missing
Bus 001 Device 005: ID 05e3:0727 Genesys Logic, Inc. microSD Reader/Writer
idVendor 0x05e3 Genesys Logic, Inc.
idProduct 0x0727 microSD Reader/Writer
为什么连接到 USB 控制器的设备出现在连接到 PCI 控制器的设备之前(应该比 USB 更快)?
是否可以编写一条udev
规则分配/dev/sdb
给此 USB 读卡器和/dev/sda
我的 SSD,以防止os-prober
出现错误(调用时update-grub
)?
EDIT1:过去,grub 安装到 SDCard 上,没有它,我的 Ubuntu SSD 磁盘就无法启动。
因此,为了避免混淆和将来的问题,我希望我的 SDCard 能够与不同的设备关联,而不是/dev/sda
如何将 SSD 切换回/dev/sda
并将 SD 卡读卡器切换回/dev/mmcblk0
?
答案1
块设备的顺序在启动过程的早期自动设置。我认为第一个准备好的设备是/dev/sda
,下一个是/dev/sdb
...
块设备名称像/dev/mmcblk0
只为通过 PCI 连接的设备保留,但内部读卡器也可以通过 USB 连接(如外部读卡器),并且它们被视为/dev/sdx
(其中 x 是一个字母)。
块设备名称的顺序不应该成为问题。Ubuntu 使用分区的 UUID 来挂载它们(或用作交换)。如果您有一些依赖于设备的工具,您可以根据它们的 UUID 或标签在它们上挂载分区。