LLI Wiki — My Digital Knowledge Base

Work around a flaky USB/SD disk: usb-storage and sdhci quirks

Disable UAS for a USB disk with usb-storage.quirks and reload sdhci with a quirk flag.

Some USB-attached SSDs and SD/eMMC controllers misbehave on Linux (disk not mounted, I/O errors). Kernel quirks can work around it.

SD/eMMC controller (sdhci)

Reload the sdhci modules with a debug quirk flag:

rmmod sdhci_pci
rmmod sdhci
modprobe sdhci debug_quirks2="0x80000000"
modprobe sdhci_pci

USB disk on Raspberry Pi: disable UAS

Some USB-SATA bridges are unstable with the UAS driver. Forcing the plain usb-storage driver fixes it.

  1. Clear the kernel log, plug in the disk, and read its vendor and product ids:

    sudo dmesg -C
    
    usb 2-1: New USB device found, idVendor=2109, idProduct=0715, bcdDevice=a0.00
    usb 2-1: SerialNumber: 0000000000
    scsi host0: uas
    sd 0:0:0:0: [sda] 234441648 512-byte logical blocks: (120 GB/112 GiB)
    
  2. Edit /boot/cmdline.txt as root and add, at the start of the parameter line, usb-storage.quirks=aaaa:bbbb:u, where aaaa is the idVendor and bbbb the idProduct. For the device above:

    usb-storage.quirks=2109:0715:u
    

    For several devices, separate the vid:pid:u triplets with commas: usb-storage.quirks=0123:4567:u,2109:0715:u.

  3. Reboot.

  4. Check that the quirk is applied:

    usb 2-1: UAS is blacklisted for this device, using usb-storage instead
    usb-storage 2-1:1.0: USB Mass Storage device detected
    usb-storage 2-1:1.0: Quirks match for vid 2109 pid 0715: 800000
    scsi host0: usb-storage 2-1:1.0
    

Notes

Mastodon LLIMastodon SocialFosstodon