Having had trouble finding the instructions I needed to resize the “disk” of my Ubuntu based virtual machine under VMware Workstation 12, I have decided to create my own little guide.
Environment and tools:
- VMware® Workstation 12 Pro 14.1.2
- Ubuntu 18.04 (upgraded repeatedly from way too long ago)
- gparted-0.30 (need to update)
Things to note are that my virtual machine is my main development environment that I have been maintaining for years now and I find that I need to give it a little extra room now and again. One of the main changes I made a while ago is to use lvm with a single volume group and only two logical groups: one for swap and one for everything else. In my opinion, it is more of a hindrance to have separate partitions for virtual machines as the major reasons for having multiple partitions do not really apply to virtual machines.
Steps:
- While the virtual machine is shut down, use VMware’s “Edit virtual machine settings” to open the settings menu.
- Click on the hard drive and then the “Expand” button.
- Increase the size to the new desired size.
- For the CD/DVD, specify the gparted iso and make sure “connect at powerup” is enabled.
- Boot the virtual machine with gparted. This might require using “Power on to Firmware” in order for the iso to boot before the OS.
- “deactivate” the partition so that it can be edited.
- resize the extended partition to fill the space.
- resize the sub-partition to fill the space.
- Apply the changes.
- Reboot into the OS.
vgdisplayto see volume group information. Note the “Free PE /Size” value.lvdisplayto get the LV Path.lvextend -L +<size>G <lv path>to resize the logical volume.resize2fs <lv path>to get the file system to adjust to the new size.