2

I have followed these instructions to create an lvm snapshot before the upgrade from 18.04 to 20.04. After the third try, the upgrade went smooth (the reasons for the first two failures have to do with this bug). Now, I would like to remove the snapshot. However, when I try to lvremove /dev/mapper/kubuntu--vg-snap I get Logical volume kubuntu-vg/snap in use.

Why is the snap in use? How to check what is holding it in use and how to safely remove the snapshot. The output of lsblk does not seem to indicate that the snap is mounted.

sda                           8:0    0 931,5G  0 disk  
├─sda1                        8:1    0   512M  0 part  /boot/efi
├─sda2                        8:2    0   732M  0 part  /boot
└─sda3                        8:3    0 930,3G  0 part  
  └─sda3_crypt              253:0    0 930,3G  0 crypt 
    ├─kubuntu--vg-root-real 253:1    0 829,3G  0 lvm   
    │ ├─kubuntu--vg-root    253:2    0 829,3G  0 lvm   /
    │ └─kubuntu--vg-snap    253:4    0 829,3G  0 lvm   
    ├─kubuntu--vg-snap-cow  253:3    0   100G  0 lvm   
    │ └─kubuntu--vg-snap    253:4    0 829,3G  0 lvm   
    └─kubuntu--vg-swap_1    253:5    0   976M  0 lvm   [SWAP]

This is the output of lsof /dev/mapper/kubuntu--vg-snap

bruni@PROX15:~$ lsof /dev/mapper/kubuntu--vg-snap
COMMAND    PID USER   FD   TYPE DEVICE   SIZE/OFF NODE NAME
grub-moun 6863 root    3r   BLK  253,4 0t38371328  439 /dev/mapper/../dm-4

and

bruni@PROX15:~$ sudo ps aux | grep 6863
[sudo] password for bruni: 
root        6863  0.0  0.0  16576  1724 ?        Ss   10:32   0:00 grub-mount /dev/mapper/kubuntu--vg-snap /var/lib/os-prober/mount
Bruni
  • 10,542

2 Answers2

1

Before removing the volume, make it inactive

lvchange -an kubuntu--vg-snap

This also gives you a reversible point to test everything before you delete the volume.

stark
  • 121
0

Killing process 6863 and restarting solved this problem for. Though, I will not accept this answer as it seems there should be a way to do this the right way.

This problem occurred again after updating from 21.04 to 21.10

Bruni
  • 10,542