With Fedora 27, when disconnecting an external USB disk drive the journal records lines like these:
May 07 22:29:11 usb 2-3.1: USB disconnect, device number 23
May 07 22:29:11 sd 3:0:0:0: [sdb] Synchronizing SCSI cache
May 07 22:29:11 sd 3:0:0:0: [sdb] Synchronize Cache(10) failed:
Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
What is one supposed to do about this?
why does the system/kernel tries to synchronize the cache after the drive is already disconnected?
Is it possible to gracefully shutdown the USB disk before the disconnect? For example with a command that issues the Synchronize-Cache command and then spins down the drive.
This would perhaps also reduce mechanical stress on the drive as the sudden power-loss with spinning disk isn't necessarily optimal.
Edit: An eject /dev/sdb
is ineffective, i.e. the above kernel messages still show up on device unplug and the disk keeps spinning. Instead the eject command yields these kernel log messages:
May 18 17:26:06 ldm_validate_partition_table(): Disk read failed.
May 18 17:26:06 Dev sdb: unable to read RDB block 0
May 18 17:26:06 sdb: unable to read partition table
May 18 17:26:06 ldm_validate_partition_table(): Disk read failed.
May 18 17:26:06 Dev sdb: unable to read RDB block 0
May 18 17:26:06 sdb: unable to read partition table
Edit: Powering the disk down with udisksctl power-off --block-device /dev/sdb
does work:
May 19 08:08:21 udisksd[9447]: Successfully sent SCSI command SYNCHRONIZE CACHE
to /dev/sdb
May 19 08:08:21 udisksd[9447]: Successfully sent SCSI command START STOP UNIT
to /dev/sdb
May 19 08:08:21 kernel: sd 3:0:0:0: [sdb] Synchronizing SCSI cache
May 19 08:08:21 udisksd[9447]: Powered off /dev/sdb - successfully wrote
to sysfs path /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.1/remove
May 19 08:08:21 kernel: usb 2-3.1: USB disconnect, device number 60
And indeed, the disk then powers down.
eject
command should do the trick. It's not just for optical drives, but for any removable media.eject /dev/sdb
is ineffective, cf. the output in the updated question./dev/sdb
is the device as a whole, not necessarily the filesystem. The filesystem is probably/dev/sdb1
or something.lsblk
can identify the filesystems for you. Then you'd need toeject /dev/sdb1
(or whatever partition is your filesystem)