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

How can you re-allocate space from one Volume Group to another Volume Group in Linux? Both volume groups exist on the same physical drive and are split evenly, let say 50G each. I'd like to shrink one down to 20G and re-assign the 30G to the other VG, extending it to 80G.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Volume Groups (VG) don't deal with raw space directly, they group Physical Volumes (PV), hence their names.

Depending on your actual VG configuration you have to do the following:

  1. display physical extents (PE) allocation among your PVs and VGs with pvdisplay
  2. (optional) reduce the size of the filesystem(s) on the first VG with e.g. resize2fs,
  3. (optional) reduce the size of the logical volume(s) containing the filesystem(s) above with lvresize,
  4. disable allocation of new PEs on one or some of the PVs on your first VG with pvchange,
  5. move used PEs from these "allocation disabled" PVs on your first VG to another PV with free PEs using pvmove (ie "compact" your first VG to a subset of PVs).
  6. remove these PVs from your first VG with vgreduce.
  7. add these PVs to your other VG with vgextend.

This is assuming that your first VG consists of multiple PVs and that you can reduce the size of the LVs so that you free up enough PEs.

All about LVM on one page is a good resource about LVM with description of similar use cases.

share|improve this answer
    
The "All about LVM on one page" is an incredible eye opener. Thanks for your guidance recommended reading! –  hsatterwhite Feb 22 '11 at 16:44

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.