Logical Volume Management

Increasing storage space

Note: These steps performed in a VirtualBox VM

Shutdown VM, if it is running.

From VirtualBox GUI, select VM -> Settings -> Storage. Select Controller: SATA -> click on the Adds hard disk button next to it.

Select Create new disk, use defaults and select a suitable disk size depending on the space available on the hard disk. Click OK when done.

Start VM, open terminal, use command lsblk to check if the new hard disk is listed (i.e., there will be an entry for /dev/sdb).

Use LVM commands to extend and resize the file system, for example:

Create physical volume:

sudo pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created

Extend volume group:

sudo vgextend ubuntu-mate-vg /dev/sdb
Volume group "ubuntu-mate-vg" successfully extended

Now resize the logical volume:

sudo lvresize -l +100%FREE -r /dev/ubuntu-mate-vg/root
Logical volume root successfully resized.
The filesystem on /dev/mapper/ubuntu--mate--vg-root is now 6950912 (4k) blocks long.

The root (/) filesystem should have now been resized. To check disk space usage, use df -h.