Adding a new disk ONLINE on a virtual Linux server is easy as adding disk to a Windows 2008/2012 Server online! No reboot required.
Make sure the following software already installed on your Linux VM.
-VMware Tools (for other hypervisor install the guest plugin on the VM)
In this example I used RedHat/CentOS running on VMware.
Technical procedures are following –
Before we began let’s see how many disks are currently provisioned on the Linux VM. To do this execute “#lsscsi” command; screenshot –
In this example the server currently have three disks (03) installed.
Now add a new disk to the VM through vSphere client. Execute the same “#lsscsi” command – the newly disk will not appear!
To get this newly added disk recognized by the Linux system we need to do “rescan SCSI bus”. Usually “SCSI bus” rescan happen every time when the machine gets rebooted – however this time we don’t want to reboot the system!
Execute the following command to rescan “scsi bus” –
# /usr/bin/rescan-scsi-bus.sh -l
(this script is a part of sg3_utils)
You should be able to see the newly added disk on the command output. Screenshot –
Now if you do a “#lsscsi” this will display four (04) disks. Previously it was three (03) disks in this example.
The new disk information will appear in “dmesg” as well; do a “dmesg | grep disk” to find details.
Next step should be partition the new disk, create file system and provide a mount point; if you want auto mount then add the partition details to “/etc/fstab”.