Detect New Hard Disk Without Reboot VMware

A new hard disk to your Linux OS running on any Virtual Environment which like VMware workstation. It won’t reflect unless you reboot the Guest OS. In order to detect the new hard drive without reboot use the following steps.

Add a New Disk To VM

First, you need to add hard disk by visiting VMware hardware settings menu.
Click on VM > Settings

Once done, check your existing iscsi device configured on your Linux.

# ls -l /sys/class/scsi_host/
total 0
lrwxrwxrwx 1 root root 0 Feb 10 04:25 host0 -> ../../devices/pci0000:00/0000:00:07.1/ata1/host0/scsi_host/host0
lrwxrwxrwx 1 root root 0 Feb 10 04:25 host1 -> ../../devices/pci0000:00/0000:00:07.1/ata2/host1/scsi_host/host1
lrwxrwxrwx 1 root root 0 Feb 10 04:25 host2 -> ../../devices/pci0000:00/0000:00:10.0/host2/scsi_host/host2

Detect a new hard drive attached you need to first get your host bus number used which you can get by using below command

# grep mpt /sys/class/scsi_host/host?/proc_name

You should get an output like below

/sys/class/scsi_host/host2/proc_name:mptspi

Rescan the SCSI Bus to Add a SCSI Device Without rebooting the VM

A rescan can be issued by typing the following command:

# echo "- - -" > /sys/class/scsi_host/host2/scan

Once done verify the list of drives in your machine.

# fdisk -l
  • if you extended the new drive for lvm and want to update without server reboot. use this command.

    resize2fs
    resize2fs /dev/mapper/vg_sba-lv_root