Nabyłem coś, co w dmesg przedstawia się następująco:
[744992.048953] usb 2-5: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
[744992.069987] usb 2-5: New USB device found, idVendor=0bc2, idProduct=2101, bcdDevice=22.01
[744992.069993] usb 2-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[744992.069996] usb 2-5: Product: JMS578
[744992.070000] usb 2-5: Manufacturer: JMicron
[744992.070002] usb 2-5: SerialNumber: 74589474
[744992.080589] scsi host5: uas
[744992.081794] scsi 5:0:0:0: Direct-Access UNITEK 2201 PQ: 0 ANSI: 6
[744992.082974] sd 5:0:0:0: Attached scsi generic sg0 type 0
[744996.105858] sd 5:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[744996.105865] sd 5:0:0:0: [sda] 4096-byte physical blocks
[744996.106119] sd 5:0:0:0: [sda] Write Protect is off
[744996.106125] sd 5:0:0:0: [sda] Mode Sense: 53 00 00 08
[744996.106484] sd 5:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[744996.106802] sd 5:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
[744996.146941] sda: sda1
[744996.186603] sd 5:0:0:0: [sda] Attached SCSI disk
Problem, że nie działa smartctl:
$ sudo smartctl -a -d sat /dev/sda
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-137-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
Read Device Identity failed: scsi error unsupported field in scsi command
A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.
Ale znalazłem coś takiego: https://www.smartmontools.org/wiki/SAT-with-UAS-Linux
Stworzyłem nowy plik wg. instrukcji:
$ cat /etc/modprobe.d/usb-storage-quirks.conf
options usb-storage quirks=0bc2:2101:u
I funga:
$ sudo smartctl -a -d sat /dev/sda
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-137-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Mobile HDD
Device Model: ST1000LM035-1RK172
Serial Number: WDE894G4
LU WWN Device Id: 5 000c50 0a9143ee2
Firmware Version: ACM1
User Capacity: 1 000 204 886 016 bytes [1,00 TB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Rotation Rate: 5400 rpm
Form Factor: 2.5 inches
Device is: In smartctl database [for details use: -P show]
ATA Version is: ACS-3 T13/2161-D revision 3b
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Thu Feb 2 13:32:37 2023 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
Zastosowanie "u" pogarsza wydajność. Dlatego najlepiej z tego korzystać tylko wtedy gdy koniecznie trzeba.
Spróbowałem jeszcze inaczej. Usunąłem "u" w nowoutworzonym pliku . Robię to na własne ryzyko. Czyli nie będzie domyślnie bez flagi NO_ATA_1X.
$ cat /etc/modprobe.d/usb-storage-quirks.conf
options usb-storage quirks=0bc2:2101:u
# umount ...
# odpiąłem dysk
# modprobe -r uas
# modprobe -r usb_storage
# podpiąłem dysk
# tail -f /var/log/kern.log
Feb 3 10:03:01 parthenope kernel: [820259.314405] usb 2-5: new SuperSpeed Gen 1 USB device number 4 using xhci_hcd
Feb 3 10:03:01 parthenope kernel: [820259.339448] usb 2-5: New USB device found, idVendor=0bc2, idProduct=2101, bcdDevice=22.01
Feb 3 10:03:01 parthenope kernel: [820259.339451] usb 2-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 3 10:03:01 parthenope kernel: [820259.339453] usb 2-5: Product: JMS578
Feb 3 10:03:01 parthenope kernel: [820259.339455] usb 2-5: Manufacturer: JMicron
Feb 3 10:03:01 parthenope kernel: [820259.339456] usb 2-5: SerialNumber: 74589474
Feb 3 10:03:01 parthenope kernel: [820259.345275] scsi host5: uas <---- WIDZE uas, nie usb-storage 2-5:1.0
Feb 3 10:03:01 parthenope kernel: [820259.345844] scsi 5:0:0:0: Direct-Access UNITEK 2201 PQ: 0 ANSI: 6
Feb 3 10:03:01 parthenope kernel: [820259.346678] sd 5:0:0:0: Attached scsi generic sg0 type 0
Feb 3 10:03:04 parthenope kernel: [820261.828124] sd 5:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
Feb 3 10:03:04 parthenope kernel: [820261.828126] sd 5:0:0:0: [sda] 4096-byte physical blocks
Feb 3 10:03:04 parthenope kernel: [820261.828277] sd 5:0:0:0: [sda] Write Protect is off
Feb 3 10:03:04 parthenope kernel: [820261.828279] sd 5:0:0:0: [sda] Mode Sense: 53 00 00 08
Feb 3 10:03:04 parthenope kernel: [820261.828570] sd 5:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Feb 3 10:03:04 parthenope kernel: [820261.828838] sd 5:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
Feb 3 10:03:04 parthenope kernel: [820261.889345] sda: sda1
Feb 3 10:03:04 parthenope kernel: [820261.928934] sd 5:0:0:0: [sda] Attached SCSI disk
# smartctl -a -d sat /dev/sda
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-137-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Mobile HDD
Device Model: ST1000LM035-1RK172
Serial Number: WDE894G4
...
Czyli wszystko działa.
Dodatkowo denerwowało mnie, że dysk po 5 sekundach się usypia. Trafiłem na to: https://www.halfbit.de/howtos/usb3-drive-standby/. W skrócie trzeba wykonać:
# hadparm -S 60 /dev/sda
# sdparm --flexible -6 -l --save --set SCT=6000,STANDBY=1 /dev/sda
Ale to drugie, co miało zapisywać nie bardzo to robi. Szukam dalej. https://bbs.archlinux.org/viewtopic.php?id=180993. Na start coś takiego:
# cat /etc/udev/rules.d/75-hdparm.rules
ACTION=="add", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", RUN+="/usr/bin/hdparm -B127 -S 60 /dev/$kernel"
Ale nie bardzo działa. Edukując się z udev (https://unix.stackexchange.com/questions/200194/how-to-debug-an-udev-rule-in-etc-udev-rules-d) powinno być raczej (nie testowałem):
# cat /etc/udev/rules.d/75-hdparm.rules
ACTION=="add", KERNEL=="sd[a-z]", ENV{ID_SERIAL_SHORT}="WDE894G4", RUN+="/usr/bin/hdparm -B127 -S 60 /dev/$kernel"
Ostatecznie staneło na dopisaniu do /etc/hdparm.conf:
/dev/disk/by-id/ata-ST1000LM035-1RK172_WDE894G4 {
apm = 127
spindown_time = 60
force_spindown_time = 60
}
I wygląda, że działa.