Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I recently ran out of space on a VirtualBox VM (CentOS guest) managed by Vagrant. It was using a .vmdk image, so I couldn't dynamically resize it. Following these instructions, I cloned the old image to a new, much larger vdi image, then attempted to resize the old partition using the GParted LiveCD. Unfortunately, even though I can see that the backing device is much larger, the partition (which is managed by LVM, since it is a CentOS guest) is displayed with a lock icon, and I can't resize it. I don't understand why the partition is locked: I'm using a LiveCD, so the FS is shouldn't be mounted (at least as I understand these things). Any suggestions on what I've done wrong? Thanks.

share|improve this question
4  
I think your issue is that GParted doesnt manage LVM partitions. I am not sure how to solve this, but I think you may need to create another regular (extended) partition from the free space, add it to the volume group, then extend your LVM volume to cover the created space, and then finally extend the file system. Essentially a manual process with command line tools. –  nwaltham May 4 '12 at 14:24
1  
@user859955 GParted still doesn't handle LVM partitions? :-( Thank you very much. –  Hank Gay May 4 '12 at 15:05

1 Answer 1

The process appears to be:

  1. create a new partition in your newly available free space; your choice of filesystem doesn't much matter, as we will change it later
  2. reboot into the system
  3. use cfdisk to flag the new partition as Linux LVM instead of whatever you chose above
  4. use pvcreate to flag your new partition as a physical volume for LVM
  5. use vgextend to add your new physical volume to your existing VolumeGroup
  6. use lvresize to expand your desired logical volume with the new space in its volume group
  7. use resize2fs to grow your fs to use the new space on your logical volume (I hope your filesystem supports online resizing)
  8. enjoy your now-spacious VM.
share|improve this answer
    
Rather than create a new partition, you should use use parted or fdisk in sector mode to delete the existing partition, and recreate it with the exact same starting sector, but a larger size. Then run pvresize to extend the pv, and then you can use lvresize and resize2fs. –  psusi May 5 '12 at 2:37

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.