Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created an instance of ubuntu VM in VirtualBox. At the beginning I have only allocated 7GB for the storage and the VM has now run out of space.

First I added another 8GB (/dev/sdb) to the VM via VirtualBox frontend. I then set up the following partitions:

$ sudo fdisk -l /dev/sdb

Disk /dev/sdb: 8589 MB, 8589934592 bytes
40 heads, 1 sectors/track, 419430 cylinders, total 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x076b5690

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    16777215     8387584    5  Extended
/dev/sdb5            4096    16777215     8386560   8e  Linux LVM

Then I ran the following commands to expand the VG.

  sudo pvcreate /dev/sdb5
  sudo vgextend ubuntudevbox2 /dev/sdb5
  sudo lvextend 100% /dev/ubuntudevbox2/root
  lvextend --help
  sudo lvextend -l 100%FREE /dev/ubuntudevbox2/root
  sudo lvextend -r -l 100%FREE /dev/ubuntudevbox2/root
  sudo resize2fs  /dev/mapper/ubuntudevbox2-root

I would have expected the size of / to expand to 16Gb. However df reports that

$ df -h
Filesystem                      Size  Used Avail Use% Mounted on
/dev/mapper/ubuntudevbox2-root  8.0G  6.9G  680M  92% /

the root mount has only increased to 8G

Here is the VG information

$ sudo vgdisplay ubuntudevbox2
[sudo] password for antkong: 
  --- Volume group ---
  VG Name               ubuntudevbox2
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               15.75 GiB
  PE Size               4.00 MiB
  Total PE              4033
  Alloc PE / Size       2182 / 8.52 GiB
  Free  PE / Size       1851 / 7.23 GiB
  VG UUID               ZV6VAi-qkxC-KnKz-1LHg-nfLB-afSI-mVpIPv

Why I did not get the full 8Gb additional space?

Additional information 1: I have run mkfs -t ext5 /dev/sdb5 right after using fdisk to add new partition. Can it cause the failure?

Additional information 2:

$ uname -a
Linux ubuntudevbox2 3.5.0-27-generic #46-Ubuntu SMP Mon Mar 25 19:58:17 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

lvdisplay output:

$ sudo lvdisplay

  --- Logical volume ---
  LV Path                /dev/ubuntudevbox2/root
  LV Name                root
  VG Name                ubuntudevbox2
  LV UUID                V1Qq0f-qKJR-UTf5-4tjM-ycoY-1J5L-mJQ2Fy
  LV Write Access        read/write
  LV Creation host, time ubuntudevbox2, 2013-03-29 12:18:26 +1100
  LV Status              available
  # open                 1
  LV Size                8.03 GiB
  Current LE             2055
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/ubuntudevbox2/swap_1
  LV Name                swap_1
  VG Name                ubuntudevbox2
  LV UUID                LbvPFE-j3GO-oaF1-HQV3-a2r5-HTfy-YrhQve
  LV Write Access        read/write
  LV Creation host, time ubuntudevbox2, 2013-03-29 12:18:29 +1100
  LV Status              available
  # open                 2
  LV Size                508.00 MiB
  Current LE             127
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1
share|improve this question
What is output of lvdisplay? – AlexD Apr 23 '13 at 16:01
Output is added to the question – Anthony Kong Apr 23 '13 at 19:59
up vote 8 down vote accepted

Output is absolute in the line

sudo lvextend -l 100%FREE /dev/ubuntudevbox2/root

Since you only had 8G of free extents after you vgextended you only get a lv representing that absolute size of 8G.

You must inform LVM you intend to make an additional space size. From the manpage of lvextend;

   -l, --extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}]
          Extend  or  set  the  logical  volume  size  in units of logical
          extents.  With the '+' sign the value is  added  to  the  actual
          size of the logical volume and without it, the value is taken as
          an absolute one.


sudo lvextend -l +100%FREE /dev/ubuntudevbox2/root
share|improve this answer
@mlfe I ran it and then sudo resize2fs /dev/mapper/ubuntudevbox2-root again. I can now see all the space I have allocated. Thanks – Anthony Kong Apr 23 '13 at 20:20

As you can see from your vgdisplay output only about a half of space is allocated:

Alloc PE / Size       2182 / 8.52 GiB
Free  PE / Size       1851 / 7.23 GiB

I suspect you need to specify parameters for lvextend more explicitly.

share|improve this answer
Agree with your diagnosis. It's difficult to debug exactly; the lvextend command-line given doesn't seem to work on my test box (debian testing). sudo lvextend -l 100%FREE /dev/mapper/vg_brick-lv_TEST seemed to work fine for me. Specifying it in PEs would be a reasonable alternative tho. It's almost as if the command used was more like lvextend -l 100%LV. Though that should have been obvious - it told me New size (1 extents) matches existing size (1 extents) Run lvextend --help' for more information.`. – sourcejedi Apr 23 '13 at 16:42
@alexd @sourcejedi I have updated the question with all the lvextend I ran. Indeed the original one did not work. Eventually I ran lvextend -r -l 100%FREE /dev/ubuntudevbox2/root. – Anthony Kong Apr 23 '13 at 20:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.