1

I am running Debian 11, using LVM.
The root partition is /dev/mainvg/lvroot.
I created a snapshot of the root partition by doing lvcreate -L5G -n bkp_lvroot -s /dev/mainvg/lvroot.

My system was in this state for a few days.

Now I wanted to remove the snapshot, like so:

lvremove /dev/mainvg/bkp_lvroot
  Logical volume mainvg/bkp_lvroot in use.

Looks like the snapshot is in 'active' state, so I tried to deactivate it:

lvchange -an -v  /dev/mainvg/bkp_lvroot
Change of snapshot mainvg/bkp_lvroot will also change its origin mainvg/lvroot. Proceed? [y/n]: n
  Accepted input: [n]
  Logical volume mainvg/bkp_lvroot not changed.

I cannot set the root partition to deactivated, can I???

Also: The snapshot is not mounted,
and lsof | grep /dev/mainvg/bkp_lvroot brings no results

My actual question is: How can I safely remove the snapshot? (I don't know how, and I don't want to break my system)

1 Answer 1

1

I already checked if the snapshot is mounted, and if there is still some open files. Turns out there is another way to check to see if something has a "hold" on the snapshot:
Use the major and minor disk number with lsof

user:/$ sudo dmsetup info -c | grep bkp_lvroot
mainvg-bkp_lvroot     254   3 L--w    1    1      0 LVM-BYqsUKtfOGMnR2
mainvg-bkp_lvroot-cow 254   2 L--w    1    1      0 LVM-BYqsUKtfOGMnR2-cow

user:/$ sudo lsof | grep "254,3"
grub-moun 430214  root    3r      BLK   254,3 0t37847040    250 /dev/dm-3

user:/$ sudo lsof | grep "254,2"
user:/$

Solution to my problem: grub-mount still accesses the snapshot

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .