Long story short, I'm using obnam to take backups of my system.
This is what I do:
- take LVM snapshot of
/
,/usr
,/boot
,/var
,/home
mount the snapshots on
/bck-snapshots
,/bck-snapshots/usr
,/bck-snapshots/boot
,/bck-snapshots/var
,/bck-snapshots/home
run the backup of snapshots:
obnam backup
/bck-snapshots
/bck-snapshots/usr
/bck-snapshots/boot
/bck-snapshots/var
/bck-snapshots/home
once the backup finishes, umount snapshot filesystems mounted in step 2.
remove the snapshots
Problem
during the backup, a system update was done, with a new kernel installed and all the grub2 update dance. Now when I try to remove the root snapshot (step 5.) I get this:
device-mapper: remove ioctl on failed: Device or resource busy
because the snapshot root device is busy and used by another process:
$ sudo lsof /dev/dm-6 # This is the root snapshot device.
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
grub-moun 9160 root 3r BLK 252,6 0t36339712 5295479 /dev/dm-6
Questions
I guess that to lvremove the snapshot I have to stop
grub-mount
to use the device. How to do that safely?I think that the backup snapshot has been added to grub as a viable option to show in the grub menu shown at boot time. What if I remove the corresponding snapshot?
Any way to prevent grub from adding the root snapshot found on /bck-snapshots ?
I have to reboot the system in order for the updates to be active, but first I have to know the answer to these questions.