How to extend VirtualBox disk capacity?

You are here:
  • FAQ
  • System
  • How to extend VirtualBox disk capacity?

Sometimes happens that you have lot of positions in DB and your virtual disk capacity is full. And you don’t want to lose your positions. But you cannot also make backup because you have no free space of the virtual disk. Then solution can be to extend the VirtualBox disk capacity. This guide will show you how to do that. Works with VirtualBox version 5.2.X.

  • Go to the Global Tools (Virtual Media Manager).

  • Extend capacity of correct vdi disk.

  • Boot VM and log in (default login: sewiortls/sensmap).
  • Run “sudo cfdisk”.
    • Make “new” partition from free space.
    • Select “logical”.
    • Select all available space.
    • Then “write” partition.
    • Type “yes” to apply changes.
    • “quit” cfdisk.
  • Reboot VM and log in again. “sudo reboot”.
  • Check your new partition. “sudo fdisk -l /dev/sda”.

  • From picture new partition is sda6, so create the physical volume. “sudo pvcreate /dev/sda6”.

  • Run “sudo pvdisplay” to show the physical volumes and note “VG Name” of current physical volume.

  • Now extend your volume group by new physical volume. “sudo vgextend sewiortls-vg /dev/sda6”

  • Extend logical volume. “sudo lvextend -l+100%FREE /dev/sewiortls-vg/root”

  • And finally resize. “sudo resize2fs /dev/mapper/sewiortls–vg-root” (Hint: Tab is sometime very useful)

  • Now check  new disk space capacity. “sudo df -h”