5

I have created a sample ruby script file for removing extra LVM snapshots from the system.

For removing LVM snapshot, we are using lvremove command. This command is working fine and we can remove snapshots from the system.

# sudo lvremove /dev/ops/dbbackup 
lvremove -- do you really want to remove "/dev/ops/dbbackup"? [y/n]: y

Sometimes while removing snapshots we are getting following errors.

Unable to deactivate open rootfs_12.10_20140812_00-cow (252:8)  
Failed to resume rootfs_12.10_20140812_00.  
libdevmapper exiting with 7 device(s) still suspended.

The system gets frozen. We cannot fire any command or can not perform any action on it.

After restarting the system, it is functioning fine. We can perform all the operations even we can delete that snapshot also.

I searched about it I found these threads https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=659762 and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=674682

Solution from this thread is after getting the error but I have to avoid this type of error.

I have a question, Is there any better way removing LVM snapshots?

So that we can avoid this type of error.

If anyone needs more info feel free to ask me.

1 Answers1

3

If you have not already, please ensure that your snapshot lv is NOT mounted prior to removing it. Just add an extra line to your ruby script to unmount the snapshot lv prior to performing the lvremove. It may also be wise to add a condition to the lvremove that requires the parition to NOT be mounted in order for the lvremove to proceed.

Hope this was helpful,

MG

MGodby
  • 1,172