If you’re experiencing LVM snapshot problems, namely:

  LV system/rootsnap in use: not deactivating
  Couldn't deactivate new snapshot

It may be related to udev. In some kernel version (from what I’ve been reading here and there), there’s a race condition between udev (the thing that makes /dev tick) and LVM. LVM creates a snapshot volume, udev grabs it, LVM loses control. You can fix this by editing your udev rules under /etc/udev/rules.d (keep in mind this fix was made on Slackware 12):

  1. Open /etc/udev/rules.d/50-udev.rules
  2. Find the line with `LABEL=”persistent_input_end”` and after this line, add
  3. KERNEL=="dm-[0-9]*",	OPTIONS+="ignore_device"
  4. Restart

That should fix it. Please keep in mind this is for Slackware 12, and even still may not work. If you really want to solve all your problems, please download and use Slack 13 :).

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.