I've got an Ubuntu Server 16.04 VM running in VirtualBox 5.0, with a 20GB drive attached (originally created as a 10GB in a VM called "box-template", then extended after the VM was cloned and renamed).

Today, when I tried using the terminal autocomplete, I got a message stating -bash: cannot create temp file for here-document: No space left on device. When I run df -i, I see the following output:

media@box-library:~$ df -i
Filesystem                            Inodes  IUsed     IFree IUse% Mounted on
udev                                  251035    475    250560    1% /dev
tmpfs                                 256039    609    255430    1% /run
/dev/mapper/box--template--vg-root    491520 491520         0  100% /
tmpfs                                 256039      2    256037    1% /dev/shm
tmpfs                                 256039      3    256036    1% /run/lock
tmpfs                                 256039     16    256023    1% /sys/fs/cgroup
/dev/sda1                             124928    313    124615    1% /boot
//                  183148544  23791 183124753    1% /media/media2
//                  183148544   7496 183141048    1% /media/media1
tmpfs                                 256039      4    256035    1% /run/user/1000

At this point, I discovered this answer which helped me to slightly better understand what this particular partition actually is. I tried looking through the HOWTO for LVM, but unfortunately my limited knowledge of linux means that I don't even know where to start in that document...

When I start up my VM booting from a GParted live CD, my "19.52 GiB" box-template-vg partition still shows "10.03 Gib" free.

VM GParted screenshot

Am I missing something important here? Or did I do something wrong when I cloned the VM and resized the drive?

Edit: Screenshot for comment request to run lvscan:

enter image description here

Edit 2: Including output of lvdisplay:

enter image description here

Just a quick side note: I actually cloned the "template" VM twice, but the other VM does not need more drive space at the moment. The df -i command on that one shows my 35% for the "IUse%" column, so in future if/when I need to resize the virtual drive on that machine, is there any thing special I need to keep in mind to prevent this issue?

  • Unlock the /dev/sda5 volume and try to expand it from gparted, let see... – George Udosen Feb 25 '17 at 10:16
  • For an answer to a similar question see unix.stackexchange.com/questions/343474/… – ridgy Feb 25 '17 at 10:46
  • @George, I had to use the "Deactivate" option from the context menu before I could resize it the first time, is that what you're referring to? Thing is, GParted is already showing that it's making use of the full space inside the "extended" partition /dev/sda2. Are you suggesting I do that to try shrink then expand the partition? – user143537 Feb 25 '17 at 11:20
  • 1
    Let us continue this discussion in chat. – George Udosen Feb 25 '17 at 12:21
  • 1
    @George, just a quick request for when you do summarise the steps we took to resolve this, could you perhaps include the basic steps that should be followed to resize an LVM partition? Even if it's simply a link to an existing post/webpage, I feel that in itself may be more beneficial to other people who come across this question in future with a similar situation. – user143537 Feb 25 '17 at 13:51

After extending the Volume Group the Logical Volume has to be extended too:

  1. Extend the logical volume with:

    sudo lvextend -l +100%FREE /dev/box-template-vg/root
  2. Run a file system check first to make sure all is well after extension:

    sudo e2fsck -f /dev/box-template-vg/root
  3. Expand the file system to accommodate the new space:

    sudo resize2fs /dev/bpx-template-vg/root
  4. Close gparted and relaunch VM


  1. To get the path of the Logical Volume Group run:

    sudo lvscan
  2. Please activate you partitions from GParted to enable steps 2 and 3 work, if not activated.

  3. Basic steps to extending a Logical Volume:

    • steps:

      • unmount logical volume
      • Extend volume group:
        • $ sudo vgextend myvolumes /dev/physical_volume
      • Extend logical volume:

        • $ sudo lvextend /dev/myvolumes/firstgroup /dev/physical_volume

          • other formats:

            Extends the size of the logical volume "vg01/lvol10" by 54MiB on physical 
            volume /dev/sdk3. This is only  possible 
            if /dev/sdk3 is a member of volume group vg01 and there are enough 
            free physical extents in it:
            lvextend -L +54 /dev/vg01/lvol10 /dev/sdk3
            Extends  the  size  of  logical volume "vg01/lvol01" by the amount 
            of free space on physical volume /dev/sdk3.
            This is equivalent to specifying "-l +100%PVS" on the command line:
            lvextend /dev/vg01/lvol01 /dev/sdk3
            Extends a logical volume "vg01/lvol01" by 16MiB using physical extents 
            /dev/sda:8-9 and /dev/sdb:8-9 for allocation of extents:
            lvextend -L+16M vg01/lvol01 /dev/sda:8-9 /dev/sdb:8-9
      • Resize filesystem to accommodate the increase:

        • $ sudo e2fsck -f /dev/myvolumes/firstgroup
        • $ sudo resize2fs /dev/myvolumes/firstgroup
      • mount logical volume:
        • $ sudo mount -t ext3 /dev/myvolumes/firstgroup /mount/point

Source(run from terminal):


LVM has three levels of abstraction:

"physical volume" (PV) is, as the name says, the basic "physical" layer. That is what refers to your hardware and what you have increased by sudo pvresize /dev/sda5. sudo pvdisplay should now show the full size and the size used.

"logical volume group" (VG) is the grouping layer for one or more PVs. You may find the name and size of your VG with sudo vgdisplay. This name should be "box--template--vg"; look for this name. With resizing PV, the VG should be automatically extended.

"logical volume" (LV) is the top layer you can use like ordinary partitions. One VG can have one or more LVs. The name and size of your LVs are shown with sudo lvdisplay. The name of your LV is "box--template--vg-root", as can be seen in the device column of df (/dev/mapper/box--template--vg-root).

This is not increased automatically when you extend the VG. So you have to extend the LV: sudo lvresize -r -l100%VG box--template--vg-root. This will resize the LV to use the full VG (-l100%VG) and then increase the size of your filesystem / as well ( -r), supposed this may be increased online (like ext4 does).

Edit: I just saw your output of lvdisplay. So increase this with sudo lvresize -r -l100%VG /dev/box-template-vg/root. Or, what is identical, sudo lvextend -r -l +100%FREE /dev/box-template-vg/root.

  • Thanks for the explanation, I am currently making some progress with George's suggestions in the question comments.. So in the interest of not trying two different sets of commands at the same time, let me first finish working through those and see where it leaves me. Your summary is very helpful either way. :) – user143537 Feb 25 '17 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy