3

I'm trying to create an snapshot from a thin provisioned lvm using the below command, but i get errors, is there anyone that can help me?

root@ghv214:/dev/ghv214-vg# lvs
  LV       VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  Thin_LVM ghv214-vg twi-a-tz-- 10.00g             0.00   10.35                           
  kvm_pool ghv214-vg -wi-ao----  2.69t                                                    
  root     ghv214-vg -wi-ao---- 59.60g                                                    
  swap     ghv214-vg -wi-ao---- 29.80g                                                    
  var      ghv214-vg -wi-ao---- 29.80g

Command to create snapshot:

root@ghv214:/dev/ghv214-vg# lvcreate -s -n snap_test ghv214-vg/Thin_LVM 
  Please specify either size or extents with snapshots.

but I can create snapshot from non-thin provisioned lvms.

Vojtech Trefny
  • 16,922
  • 6
  • 24
  • 48

1 Answers1

5

ghv214-vg/Thin_LVM is a thin pool (the lower t attribute stands for thin pool), not a thin LV so you are trying to create a "normal" snapshot of a thin pool which requires size to be specified. In general it doesn't really make sense to create snapshot of the thin pool, you want to snapshot the thin LVs. But you actually don't have a thinly provisioned LV in your system, when creating a thin pool you can create the thin pool and a thin LV on it with one command:

lvcreate --type thin -V VirtualSize -L LargeSize -n ThinLV --thinpool VG/ThinPoolLV

but if you are doing it separately (creating the pool first) you need to create the thin LV later with

lvcreate -n ThinLV -V VirtualSize --thinpool VG/ThinPoolLV

and then you can create the snapshot of the thin LV with

lvcreate -n SnapLV --snapshot VG/ThinLV

See lvmthin man page for more information.

Vojtech Trefny
  • 16,922
  • 6
  • 24
  • 48