Scan newly added disks or rescan resized disk in Linux VM

Interesting data center technical tips / tasks / articles which we come across

Scan newly added disks or rescan resized disk in Linux VM

November 1, 2017 Linux Troubleshooting vmware 0

How do we rescan for new disks after adding a VMDK to a Linux Virtual Machine?

First, list all disks available in the VM
sudo fdisk -l
Running the following command will scan for new scsi disks.

sudo echo "- - -" > /sys/class/scsi_host/host0/scan
..
..
sudo echo "- - -" > /sys/class/scsi_host/hostN/scan

Run this command for all scsi_hosts.

Well, if you have increased the size of an existing disk, then the above procedure will not identify that. In that case, you have to first identify the disk which has been resized. And then go to the disk directory. And then enable rescan for that drive

cd /sys/class/scsi_disk/n\:n\:n\:n/
echo '1' > device/rescan

Leave a Reply

Your email address will not be published. Required fields are marked *