Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using LVM to allocate disk for my VMs so I can increase the "physical disk size".

The only way I found to merge this free space to my VM Volume Group was:

  1. create a partition on new free space
  2. extend the volume group with the new partition

As I often need to increase vm disk, this solution seems to me a little bit dirty.

Any better way to extend vg to free space?

Regards

share|improve this question
    
You mean other way than this example –  mirkobrankovic Jul 3 '13 at 11:38
    
Exactly: "How to Increase the size of a Linux LVM by expanding the virtual machine disk" uses the method I already described which I don't like (I not sure that the concatenation of 20 pv comming from the same hard disk is efficient), the one with gparted does not work with Volume Groups :( –  trax Jul 3 '13 at 12:45
    
+1 and favorited, I'd like to know if there is a way too :D –  mirkobrankovic Jul 3 '13 at 12:51

1 Answer 1

up vote 1 down vote accepted

You should also be able to extend the existing partition (which is a "physical volume"). First resize the partition using fdisk or whatever, then run pvresize /dev/partition . See man pvresize.

Note: you probably can't convince the kernel to notice first the increased disc size, and if you can, then after modifing the partition table, you'll need to convince the kernel to re-read the partition table which you probably can't do either. A reboot is a sure way. So, first resize the disc from the virtual host, then reboot. Resize the partition with fdisk, reboot. Then run pvresize. If you need to do this without reboots, then the best way is just to add a new disk to the VM. That can be detected for sure without a reboot.

share|improve this answer
    
how to however I had to replace fdisk with parted because of alignment issues –  trax Jul 3 '13 at 15:23

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.