Linux – Resizing logical volume with no free extents but with free disk space

linuxlvmxfs

I have a 7.9 TB logical volume formatted with XFS filesystem. I have 8 1 TB RAID devices as physical volumes, and 1 volume group that contains all of these devices. I have 2.5 TB free space on my logical volume. I'd like to remove 2 of the 1 TB devices from the volume group since I don't "need" them anymore. Reading the man page of pvmove, it seems like I would need to create at least 5.5 TB of space and pvmove everything from the current 1 TB volumes onto the new volumes, and then remove all 8 of the original volumes from the logical volume. This seems onerous. Any suggestions?

Best Answer

There's no problem on the LVM side. Use lvreduce to shrink a volume group; obviously, if there's a filesystem on it, you mustn't shrink it below the size of the filesystem. Then use pvmove to shuffle extents around: pvmove /dev/sdz42 removes extents from the physical volume /dev/sdz42 to other physical volumes in the same volume group, after which you can decommission the physical volume with vgreduce.

However this is moot since you have an XFS filesystem, and XFS does not support shrinking. I'm afraid you'll have to move the data off and remake the filesystem (and thus you can be completely unsubtle with LVM).

Related Question