VMware & Linux Hot-Add Disks

Did you know you can add new virtual hard disks to a running Linux VMware VM, and they can be visible to the OS without a reboot?

First, add a new hard disk the way you’d normally do it (Edit Settings -> etc.). Add it to the existing virtual SCSI adapter (don’t create a new one).

Then, use a script like Kurt Garloff’s rescan-scsi-bus.sh to pick up the new device.

If you’re using the Linux Logical Volume Manager you can partition the new device, run pvcreate, add it to a volume group, and grow a filesystem with ext2online/resize2fs (RHEL 4/5), all without the end users noticing.

Just don’t forget to align the partitions on the new device before you use it. Misaligned I/O is a serious performance drag.

2 thoughts on “VMware & Linux Hot-Add Disks”

  1. When adding a disk inside a VM, we simply use the following:

    echo “- – -” > /sys/class/scsi_host/host0/scan

    This will only work when adding a local disk to the first host adapter which is usually the case for VMs.

    Then you can use ‘dmesg’ to see the name of device that was created. (/dev/sdX)

Comments are closed.