Rescan disk in Linux

When adding disks or enlarging existing disk in our VMs I use this twoliner to trigger a rescan of disks:

for i in /sys/class/scsi_host/host*/scan ; do echo "- - -" >$i ; done
for i in /sys/class/scsi_disk/*/device/rescan ; do echo "1" >$i ; done
Advertisements