The Ubtunu LTS Hyper-V virtual machine I've been using for developing my Gatsby site died because it ran out of storage space.

I could rebuild the VM, but I would loose everything not yet backed up, so the obvious choice was to increase the available storage.

This is only applicable to Logical Volume Manamgent installations.

  1. Verify that ubuntu--vg-ubuntu--lv is out of free space.
sudo df -h
  1. Turn off the VM.
sudo shutdown -h now
  1. Use Hyper-V Manager to select the Settings of the Virtual Machine, select the Hard Drive option and Edit under Virtual hard disk. Under Choose Action, ensure Expand is selected, then us Configure Disk to increase the size.

  2. If not using English, override locale settings to avoid issues with non-English locales:

LC_ALL=C
  1. Expand the sda3 partition.
sudo growpart /dev/sda 3
  1. Use pvresize to expand the Physical Volume to fill the partition.
sudo pvresize /dev/sda3
  1. Use lvextend to expand the Logical Volume to fill the Physical Volume.
sudo lvextend --extents +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
  1. Enlarge the mounted file system.
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
  1. Finally verify that more storage is available.
sudo df -h

Copyright Chad Tomlinson. All rights reserved.