Online Resize (non-root) Linux Partitions on VMWare Guests

By | 10. August 2014

Several VMs continuously need more HDD space, for example my BackupPC instance. For this reason I’ve put the actual data on a separate Hard Disk and partition, to allow an online-resize of the partition, if necessary. This article explains the procedure for Debian guest on a VMWare infrastructure, but it should work similar on other distributions or hypervisors.

Unmount Filesystems

On the guest OS, first unmount all filesystems on the hard disk at question.

Resize HDD in VMWare

First step is to increase the size of the hard disk in VMWare. As you are probably are already running an ESXi infrastructure when reading this post, I’m not going to explain this in detail. Have the following screenshot, though.

VMWare: Resize HDD

VMWare: Resize HDD

Rescan Partition Table

The next step is to re-scan the hard disk and inform the Kernel about the new capacity of the hard disk. Easiest way is to use lsscsi to get the device ID and then to perform a rescan. Find the ID (value in brackets at the beginning of the line), and use it to instruct the Kernel to re-scan the size:

We should see the result of this using dmesg:

Resize Partition

Now, the Kernel has detected the new capacity of the HDD. Now we have to resize the partition, before we can increase the actual size of the Filesystem. We use fdisk for this task. First, we delete the current partition (but remember start cylinder!), then we create a new primary partition, with same start cylinder but higher end cylinder.

Resize Filesystem

Final step is to resize the actual Filesystem, in my case EXT3. First, check the integrity of the file system. This will take several minutes, so get yourself a coffee.

If everything is okay, finally resize the Filesystem:

Thats it, now you can mount the partition again, with extended capacity.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.