Adding new virtual disks to a RHEL host in ESX "live"
I'm sure I've just missed which tutorial/manual page covers this, but how do you add get the guest OS to recognize that you've added new drives to it without a reboot?
I have a RHEL5 guest running on ESX 4. I've added new virtual disks to the VM, but have not figured-out how to get the guest to recognize them without a reboot.
Is this possible? If so, how?
Specifically, I'd like a way to do this in RHEL, but any other Linux distribution or edition of Windows would be nice, too.
This is just like hot plugging (not a great idea on physical systems) any scsi device to an rhel system. You'll need to get the SCSI subsystem to add a new device. This is done by echoing the following to the file /proc/scsi/scsi
to add a device: echo "scsi add-single-device <h> <c> <i> <l>" > /proc/scsi/scsi
where:
h = host
c = Channel
i = ID
l = LUN
As an example i just added a second HD to a VM using the default settings for SCSI.
echo "scsi add-single-device 0 0 1 0" > /proc/scsi/scsi
A typical VM has all the virtual disks attached to SCSI host zero, so rescan all its channels with
# echo - - - > /sys/class/scsi_host/host0/scan
or with sudo
:
$ echo - - - | sudo tee /sys/class/scsi_host/host0/scan
This works with any Linux 2.6 kernel, so RHEL 4, 5 or 6.