(Re)discover new LUN in linux without rebooting

Note to self… Has 1 disk (/dev/sda) and want to “find” newly added disk (/dev/sdb) without reboot:

echo 'scsi add-single-device 0 0 1 0' > /proc/scsi/scsi

The first “0” is the controller, next “0” is the SCSI channel, the “1” is the target ID, and the last “0” the H-LUN.

After repartitioning with fdisk, the kernel remembers the old partition table, so remove the device and add it again to refresh it:

echo 'scsi remove-single-device 0 0 1 0' > /proc/scsi/scsi
echo 'scsi add-single-device 0 0 1 0' > /proc/scsi/scsi

Leave a Reply