Proper way to remove an active / inactive LVM snapshot
- by user2622247
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.