Linux : HowTO resize guest virtual disk and new disk size without reboot

By | July 22, 2016

If you are running mission critical VMs under VMware, that even doing a planned maintenance for reboot to increase disk space isn’t a proper justification to achieve this task, you have to find a way to to it on the fly! Fortunately, there is ways around to make it happen.

1. You will first do the vDisk space increase at the virtualization level from vCenter.

2. Then, inside your guest VM, you will have to tell the OS that the drive size has changed, to achieve this, you’ll need first to find that specific drive SCSI ID as followed :

Alternatively, you can use “lsscsi” utility which I prefer (because it is more informational) but isn’t installed by default. To install it, simply do :

Then run the following command :

3. Now that we are in position to identify the drive SCSI ID, we will tell the OS to rescan the SCSI bus of that specific device as followed

NOTE : This example assume that your device is Host: scsi2 Channel: 00 Id: 03 Lun: 00 (2:0:3:0)

At this point, depending on how your partitioning and filesystems are set, you need to take the appropriate steps to fit your design. If unfortunately, you have a partition table on your drive, you will have to delete and re-create it (hazardous but works!).

NEXT STEPS : Optional – this is based on how my guest VMs are setup. If you are using partition tables and do standard partitioning without LVM, the following steps the following example isn’t for you!

Because of flexibility it provide, I use LVM (physical volume) raw on disk, without any MBR or GPT partition table. This make space increase very easy as I will show you in the next steps.

4. Resize the physical volume (PV) :

NOTE : The command above assume that your physical volume is located on “/dev/sdd” block device. You can use the “pvdisplay” command to list the available physical volumes available on the system.

5. Resize the logical volume (LV) :

NOTE : The command above will make the LV take the whole available disk space and assume that the volume group name is “vg_system_vd4” and the logical volume name is “LogVol_backup”. You can use “vgdisplay” and “lvdisplay” commands to list the available volume group and logical volumes on the system.

6.0. Resize the partition (EXT4) :

6.1. Resize the partition (XFS)