In my previous article Resizing a VMware Fusion Ubuntu Server Virtual Drive (via Easy Mode), I described what was needed to enlarge your Virtual Drive (VHD) on a VMware Fusion VM that was setup by the “Easy Install” method. If you are confused by what the “Easy Install” method is, there is a prompt when creating a new VM that asks you to provide information for a new account:
By deselecting the “Use Easy Install” checkbox, you will be required to walk through the OS install setup just like if you were loading a physical CD into a physical machine. One of the steps during the setup assistant for Ubuntu Server is partitioning your Drive which has a default value of “Guided - use entire disk and set up LVM”.
LVM stands for Logicial Volume Management. I found the best quickest explanation for why you would want an LVM environment in the Ask Ubuntu forums:
You can think of LVM as “dynamic partitions”, meaning that you can create/resize/delete LVM “partitions” (they’re called “Logical Volumes” in LVM-speak) from the command line while your Linux system is running: no need to reboot the system to make the kernel aware of the newly-created or resized partitions.
The Benefits of LVM
So let’s see what we are working with and how it differs from the “Easy Install”. We’ll launch our new Ubuntu Server VM and perform the same tasks as last time to get a sense of how much space is available.
HELLO! That was a lot more information than last time! The biggest clue as that we are dealing with a LVM system (outside the amount of text that is returned from one command) is the “Linux LVM” description for /dev/sda5.
Let’s see what are the results from our command after we increase our VM size from 20GB to 30 GB (like we did last time).
DRAT! We’re still in the same situation as last time that our environment knows we should have 30GB of space (e.g. “Disk /dev/sda: 32.2 GB”), but the number of blocks for /dev/sda5 is not showing any change nor did “Disk /dev/mapper/ubuntu–vg-root” increase in size (e.g. “19.1 GB, 19050528768 bytes”).
To see additional information about our LVM environment we can use the lvscan and lvs commands to find the size of our LVMs, the name of the Logical Volume, and Volume Group (in this case, “ubuntu-vg”). Full LVM details are available via lvdisplay command (think of this as diskutil cs list for OSX admins).
Steps to Increase your VMware Fusion LVM
First thing we need configure to increase the disk space of our VM is by using the sudo cfdisk command to create a new Primary partition using the 8e/lvm format from our “Free Space”. The steps (with screen shots below) are:
Find your “Free Space” and create a new partition
Select to create a Primary partition
Use the entire partition by using the Enter key
Change the partition Type
Use “8E” (case sensitive) for “Linux LVM”
Write the new partition map
Type “yes” to verify partition map
You may noticed immediately after we write the partition map there was a error message at the bottom of the screen that states “Wrote partition table, but re-read table failed. Run partprobe(8), kpartx(8) or reboot to update table”… please reboot. Once restarted, we’ll run sudo fdisk -l again to grab the location of our new partition (truncated for brevity).
Next we need to do the following steps all via command line
This was spot on and worked perfectly on my VMware ESXi setup – thanks!