Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a VM running Ubuntu. It used to have 30GB of space; I need to increase the size of the data partition, a LVM2 one, to 50GB.

I changed the size in the VM's management console and this is what fdisk -l tells me:

Disk /dev/sda: 53.7 GB, 53687091200 bytes                      <--- new size

[...]

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          32      248832   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              32        6528    52177921    5  Extended  <--- huh?!?
/dev/sda5              32        3917    31205376   8e  Linux LVM <--- old size

[...]    

I had read up plenty of stuff about LVM first, and ended up with this Serverfault question about resizing a LVM partition on the fly.

sda2 seems to be the container containing sda5, which if I understand LVM correctly is the way things should be.

However, when I try

sudo lvextend /dev/DOCS/root -l+100%FREE

I get

New size (7118 extents) matches existing size (7118 extents)

I don't fully grasp the concept of LVM yet. Do I need to enlarge something else first, like the "outer container" of the partition?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

This has come op before:

See this How to grow LVM and underlying partition? for a way to get the desired result without having to re-create the existing partition in fdisk.

share|improve this answer
    
I did it this way after all. Thanks! –  Pekka 웃 Jan 28 '13 at 18:07

You need to expand the partition (/dev/sda5) first. Go into fdisk, delete /dev/sda5, create a new extended partition (/dev/sda5 - it MUST be the same number as the old one), write the changes out and reboot. Then you can lvextend.

Be careful - doing this wrong will lead to data loss.

share|improve this answer
    
Thanks John. I'll make a snapshot of the VM and give this a try, as I've already extended the HD this may be the easiest way –  Pekka 웃 Jan 28 '13 at 16:28
    
I can't get this to work without losing the entire partition complete with all data. Is there a trick to this? –  Pekka 웃 Jan 28 '13 at 17:45

Your Answer

 
discard

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.