Skip to contentSkip to conversation

"Condensing" Physical Volumes

linux-lvm David Baron 1 participant 1 message Dec 6, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 20 lines · On Monday 06 December 2010 06:10:02 [email protected] wrote:
Quoted 8 lines

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:

Quoted 8 lines

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.

Quoted 8 lines

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.

Quoted 5 lines

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).