2

After installing Ubuntu 20.04 LTS on my Asus EP1501P, I found out my SDCard reader was associated with /dev/sda instead of /dev/mmcblk0 and my main SSD with /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) 

And when there is no SD Card inside the SD Card reader, I get these errors when updating grub configuration :

$ 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 : The SD Card reader is connected to the USB Bus instead of the PCI Bus :

$ 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

How come the device connected to the USB controller appears before the device connected to the PCI controller (supposed to be faster than USB) ?

Is it possible to write an udev rule to assign /dev/sdb to this USB card reader and /dev/sda to my SSD so as to prevent os-prober errors (when calling update-grub) ?

EDIT1 : In the past, grub got installed onto the SDCard and my Ubuntu SSD disk could not boot without it.

So, to avoid confusion and future problems, I would love for my SDCard to be associated with a different device than /dev/sda

How do I switch the SSD back to /dev/sda and the SD Card reader to /dev/mmcblk0 ?

SebMa
  • 2,927
  • 5
  • 35
  • 47

1 Answers1

2

The order of the block devices is set automatically early in the boot process. I would say that the first device that it ready is /dev/sda and the next is /dev/sdb ...

Block device names like /dev/mmcblk0 are reserved for devices connected via PCI, but internal card readers can also be connected via USB (like external card readers), and they are seen as /dev/sdx (where x is a single letter).

The order of the block device names should not be a problem. Ubuntu uses the UUID of the partitions in order to mount them (or use as swap). If you have some own tools, that depend on devices, you can mount partitions on them according to their UUID or label.

sudodus
  • 47,684