[linux-lvm] "Condensing" Physical Volumes

David Baron d_baron at 012.net.il
Mon Dec 6 12:34:11 UTC 2010


On Monday 06 December 2010 06:10:02 linux-lvm-request at redhat.com wrote:
> > I need more extents to move stuff off older, possibly failing IDE disks
> > to my  new SATA terrabyter. However, not enough extents are available.
> > The disk is very sparsely populated.
> >
> > 
> >
> > Is there any way to "condense" physical volumes to recover/expose empty 
> > extents in order to make use of them?
>
>     Is your situation actually the following?:
> 
> The volume group is nearly full, meaning that most all
> of the extents are used by logical volumes.
> 
> On those logical volumes you have file systems.
> 
> Those file systems have free space.
> 
> If the above three conditions hold, you'd need to:
> 
> reduce the size of the file systems, perhaps using ex2resize.
> 
> Once each file system is reduced, you would then be able to reduce
> the logical volume which contains that filesystem.
> 
> That will mean there are free extents in the volume group, so you can
> then use pvmove to move the extents off of the chosen physical
> volumes.
That's about it.

Reducing the size of logical volumes was the first thing I thought of but it 
wants to umount them to do this--not so cool if they are /usr and stuff like 
that. I suppose this could be done using the Debian live CD.

Either /usr or /home could easily be shrunk leaving plenty of extents for the 
pieces still on an IDE disk.

> 
> Does pvmove --alloc anywhere help?
> 
> Alternatively, you can specify exactly which extents go where,
> like in "pvmove --test -n lvname.to.move /dev/pvold:20-27
> /dev/pvnew:732-739". obviously, remove --test, if it seems to do what you
> meant.
> 
> To see which what is where, and which extent ranges are free,
> I tend to use variants of
> pvs -o vg_name,lv_name,pv_name,pvseg_start,pvseg_size,seg_pe_ranges
> -Opv_name,pvseg_start Note that pe_ranges are inclusive, (end of the range
> is: pvseg_start  + pvseg_size -1).

I am not really conversant in the CLI tools so I do not know how to do this.

The only free exents are on a PV I created out of a partition which I had 
intended for another use. I pmoved the stuff from one of the IDE disks to this 
PV. A bit scary but worked fine despite problems with that IDE disk (which was 
then removed, thankfully).




More information about the linux-lvm mailing list