You are not logged in.

#1 2025-06-24 16:47:21

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,297

[SOLVED] external usb drive fails during writing

I have an external Crucial X9 nvme ssd drive that has recently started to hang during write of files as a backup.
The writing of files onto the ext4 filesystem on the drive gives journal errors in the log with many lines including:

Jun 24 17:32:16 swift1 kernel: sd 0:0:0:0: [sda] tag#3 uas_eh_abort_handler 0 uas-tag 2 inflight: CMD IN 
Jun 24 17:32:16 swift1 kernel: sd 0:0:0:0: [sda] tag#3 CDB: Read(10) 28 00 00 81 5f b8 00 00 08 00
Jun 24 17:32:16 swift1 kernel: scsi host0: uas_eh_device_reset_handler start
Jun 24 17:32:17 swift1 kernel: usb 2-2: reset SuperSpeed USB device number 7 using xhci_hcd
Jun 24 17:32:17 swift1 kernel: scsi host0: uas_eh_device_reset_handler success
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#15 uas_eh_abort_handler 0 uas-tag 15 inflight: CMD IN 
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#15 CDB: Read(10) 28 00 00 80 17 40 00 00 f0 00
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#14 uas_eh_abort_handler 0 uas-tag 14 inflight: CMD IN 
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#14 CDB: Read(10) 28 00 00 80 17 38 00 00 08 00
Jun 24 17:32:47 swift1 kernel: scsi host0: uas_eh_device_reset_handler start
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#13 uas_zap_pending 0 uas-tag 1 inflight: CMD 
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#13 CDB: Read(10) 28 00 00 81 5f b8 00 00 08 00
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#8 uas_zap_pending 0 uas-tag 9 inflight: CMD 
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#8 CDB: Write(10) 2a 00 3a 5a e4 28 00 04 00 00
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#9 uas_zap_pending 0 uas-tag 10 inflight: CMD 
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#9 CDB: Write(10) 2a 00 3a 5a e0 28 00 04 00 00
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#10 uas_zap_pending 0 uas-tag 11 inflight: CMD 
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#10 CDB: Read(10) 28 00 00 81 49 60 00 00 08 00
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#11 uas_zap_pending 0 uas-tag 12 inflight: CMD 
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#11 CDB: Write(10) 2a 00 3a 5a dc 28 00 04 00 00
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#12 uas_zap_pending 0 uas-tag 13 inflight: CMD 
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#12 CDB: Write(10) 2a 00 3a 04 00 28 00 00 08 00
Jun 24 17:32:47 swift1 kernel: usb 2-2: reset SuperSpeed USB device number 7 using xhci_hcd
Jun 24 17:32:47 swift1 kernel: scsi host0: uas_eh_device_reset_handler success
Jun 24 17:32:47 swift1 kernel: sd 0:0:0:0: [sda] tag#15 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_O>

I have tried to change the drive to be in discard mode using:

# cat /sys/block/sda/device/scsi_disk/*/provisioning_mode
full
# echo "unmap" >/sys/block/sda/device/scsi_disk/*/provisioning_mode
# cat /sys/block/sda/device/scsi_disk/*/provisioning_mode
unmap

and then running fstrim succeeds:

# fstrim -v /run/media/mike/Crucial-1TB
/run/media/mike/Crucial-1TB: 257.6 GiB (276596154368 bytes) trimmed

It still fails during the longish writes and hangs, so I also tried adding a quirk prior to mounting the drive, so that uas is not used as I had seen posts in another forum suggesting that uas can be a problem with some external drives - but the problem persists if I do:

# modprobe usb-storage quirks=0634:5605:u

Has anyone else had similar problems with a mounted external 1TB nvme ssd drive?  If so is there a solution, or it is necessary to get a different kind of external drive to keep backup files on?

Last edited by mcloaked (2025-06-24 18:39:49)


Mike C

Offline

#2 2025-06-24 17:45:19

seth
Member
Registered: 2012-09-03
Posts: 66,156

Re: [SOLVED] external usb drive fails during writing

https://wiki.archlinux.org/title/Power_ … utosuspend ?

but the problem persists if I do

You still get UAS related errors?
The usb ID seems to match some crucial drive (and micron controller) but UAS should™ get disabled for that - did you actually (re) load the usb-storage module with the quirks?
(If you try to load an already loaded module, nothing happens and you cannot unload it while it' in use)

Offline

#3 2025-06-24 18:20:51

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,297

Re: [SOLVED] external usb drive fails during writing

Thanks, Seth.  It is certainly possible that the module wasn't loaded properly with the quirks - I did umount the drive and remount it - but I should check the module really is unloaded first before doing the modprobe command - I should check that the module is properly no longer used once the drive has been removed as I don't know how long it takes to be 'unused'.


Mike C

Offline

#4 2025-06-24 18:24:01

seth
Member
Registered: 2012-09-03
Posts: 66,156

Re: [SOLVED] external usb drive fails during writing

systool -vm usb_storage | grep quirks

In doubt just add "usb-storage.quirks=0634:5605:u" to the https://wiki.archlinux.org/title/Kernel_parameters - the module will then load with that quirk for sure and you can test the behavior

Offline

#5 2025-06-24 18:36:20

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,297

Re: [SOLVED] external usb drive fails during writing

I took a slightly different tack bearing in mind your post.  I umounted the drive, and then waited a while - but the usb-storage module seemed still busy so I did:

# rmmod uas
# rmmod usb-storage
# modprobe usb-storage quirks=0634:5605:u

Then plugged the drive back in and:

# lsmod | grep uas
uas                    36864  0
usb_storage            90112  2 uas

Then running modinfo usb-storage had at the end of the output:

parm:           quirks:supplemental list of device IDs and their quirks (string)

Only then did I run:

# echo "unmap" >/sys/block/sda/device/scsi_disk/*/provisioning_mode

Once that was done running my backup to the drive went fast, and completed without error, and there were no longer the long streams of lines in the journal. So this approach did work.

I guess it is possible to get the quirks loaded automatically to stop uas being used, so that for future use of the external drive is easier to execute the backup.

Edit: Thank you for the kernel parameter suggestion to put the quirks in at boot.

Last edited by mcloaked (2025-06-24 18:37:39)


Mike C

Offline

#6 2025-06-24 18:54:23

seth
Member
Registered: 2012-09-03
Posts: 66,156

Re: [SOLVED] external usb drive fails during writing

You can also use https://wiki.archlinux.org/title/Kernel … modprobe.d
(long term this scales better, the kernel parameters are just a quick, easy and very reliable way to check the behavior)

Offline

#7 2025-06-24 19:17:12

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,297

Re: [SOLVED] external usb drive fails during writing

Great - thank you.


Mike C

Offline

Board footer

Powered by FluxBB