4

To test out thinly provisioned snapshots before applying them to a production system for backup purpose, I did the following:

lvcreate -L1G -T storage/thinpool
lvcreate -V10M -T storage/thinpool -n thinvol1
lvcreate -V10M -T storage/thinpool -n thinvol2
# [create ext4 fs on thinvol1, mount it, add some files]
lvcreate -s --name snap1 storage/thinvol1

All commands succeeded, but when lvdisplay storage/snap1 gives as status NOT available and \dev\storage\snap1 is not created by the device mapper: --- Logical volume --- LV Path /dev/storage/snap1 LV Name snap1 VG Name storage LV UUID csDP34-HlpY-Rd8x-yJgr-99PW-jHZu-T7wsUJ LV Write Access read/write LV Creation host, time localhost.localdomain, 2015-11-24 10:01:43 +0100 LV Pool name thinpool LV Thin origin name thinvol1 LV Status NOT available LV Size 12.00 MiB Current LE 3 Segments 1 Allocation inherit Read ahead sectors auto

lvchange -a y storage/snap1 made no difference either. Did I just miss a final step to make the snapshot accessible? Or what else could be the problem here?

OS: Fedora 22 (x64) Kernel: 4.2.6-200.fc22.x86_64 LVM2: 2.02.116

MadHatter
  • 79,770
  • 20
  • 184
  • 232
neradis
  • 143
  • 1
  • 6

1 Answers1

7

By default, thin snapshot are set as not available and with the "skip activation" bit set.

Try issuing lvchange -ay -Ky storage/snap1 and your thin snapshot should become available.

To permanently set off the "skip activation" flag, issue lvchange -kn storage/snap1

shodanshok
  • 47,711
  • 7
  • 111
  • 180
  • 1
    Oh good God! I see why this is needed logically, but it's still a pain. Also, I'm going to have to break the "thank you" rule and say THANK YOU! I spent a while on this one. I'm using so many VMs these days that I've got to start using thin provisioning and such to save space. EDIT: Nice logo!! Ahh, good ole commies. – Daniel Santos Nov 10 '19 at 07:56
  • 1
    @DanielSantos do you know why this is logically needed? I dont understand the reasoning behind it. – user128063 Dec 12 '20 at 05:19
  • 1
    [ -K|--ignoreactivationskip ] is not even in the old man pages https://linux.die.net/man/8/lvchange – user1133275 Jan 16 '21 at 19:46
  • @user1133275 hehe, I'm a little late, but I'm going to guess it's to prevent accidental use of a thin snapshot that is intended to be a backup of something. That's the only thing I can think. It would have been nice to document the rationale. – Daniel Santos Apr 26 '22 at 23:00