Score:1

Cannot remove LVM snapshot

cn flag

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)

Score:1
cn flag

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

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.