The following is the GNU All-permissive License as recommended in https://www.gnu.org/licenses/license-recommendations.en.html

Copyright (C) 2024 Free Software Foundation sysadmin@fsf.org

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.

Contributions are welcome. See https://savannah.gnu.org/maintenance/fsf/.

soft-reset drive

To reset a hard drive without physically removing it:

readlink /sys/block/sdX

../devices/pci0000:00/0000:00:1f.2/**host1**/target1:0:0/1:0:0:0/block/sr0

Force disconnect the device:

echo 1 > /sys/block/sdX/device/delete

Notice the host1 in the returned line above. That’s the controller that needs rescanned. Trigger rescan:

echo "- - -" > /sys/class/scsi_host/host1/scan

https://zedt.eu/tech/linux/soft-resetting-sata-devices-linux/