200910.28

How to shrink an LVM volume

So maybe you're like me and wanted to play with LVM to speed up MySQL backups. Maybe you didn't realize that to take LVM snapshots, you can't use the entire volume when you format it. Fret not, here's a simple way to reduce the size of an LV, giving you some breathing room for your backups:

	# umount /dev/db/data
	# e2fsck -f /dev/db/data
	# resize2fs /dev/db/data 200M
	# lvreduce -L 200M /dev/db/data

You cannot reduce the volume or filesystem size to less than the amount of space the data takes up (without losing data). But if you figure out how, you'll be pretty rich. And never do this to anything you cherish without taking a backup.

There it is. Now check out mylvmbackup if you haven't already.