Linux Rescan – Purpose of /sys/block/sd?/device/rescan

hotswaplinuxlinux-kernelsata

I need to "rescan" the SATA bus of our Linux server in search of a hotplug device that doesn't show up. I've seen an old question on the topic (How do I make Linux recognize a new SATA /dev/sda drive I hot swapped in without rebooting?) and the information given there did work.

However, I also noticed there was a rescan entry in /dev/block/sd?/device.

So, can I assume the following:

echo 1 > /sys/block/sdd/device/rescan

would be equivalent to:

echo 1 > /sys/block/sdd/device/delete
echo "- - -" > /sys/class/scsi_host/host4/scan

Best Answer

Strictly speaking they are not equivalent but they may achieve the same outcome.

The first command requests the system rescan the specified device for changed device parameters.

The second command deletes the specified device and rescans the SCSI subsystem for new devices and reads their parameters. It's possible then, that additional changes not related to the specific device may occur.