Disk Management!

It turns out that you can add and remove SCSI, and thereby SAS/SATA, disk drives without forcing a system reboot. To force a rescan of the SCSI controller you need to first find the SCSI controller hosts.

First, we’ll cover re-scanning the SCSI controller after you’ve added a new disk.

$ ls /sys/class/scsi_host/

The output will vary, depending on your system, but it should look something like this:


You can now issue the following command(s) to force a rescan of the SCSI bus controller:

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

Continue the echo command until you’ve hit all of your hosts.

Now we’ll cover how to gracefully remove a disk from your system.

First, ensure that you have unmounted the drive. In my example I will be removing /dev/sdb from the system, modify your command to include the specific device you are removing.

# umount /dev/sdb1

Once your drive is unmounted, you can issue the following command to signal the Linux kernel to remove the device.

# echo 1 > /sys/block/sdb/device/delete

You could verify the kernel message by inspecting the last few lines of dmesg to ensure the disk was removed.