Table of Contents

Data recovery

hdparm -c0 /dev/sdi
hdparm -X1 /dev/sdi
hdparm -d0 /dev/sdi
echo 1 > /sys/block/sdi/device/queue_depth

fast erase whole disc

sudo hdparm --user-master u --security-set-pass ABC /dev/sdX
sudo hdparm --user-master u --security-erase ABC /dev/sdX
 
# check if device security is "not enabled"
hdparm -I /dev/sdX

sata hotplug

Plug

echo 0 - 0 > /sys/class/scsi_host/host5/scan

Rescan all ports:

exec tee /sys/class/scsi_host/host*/scan <<<'- - -' >/dev/null

Unplug

echo 1 > /sys/block/(whatever)/device/delete