5

I have the following lvm configuration.

Hard Disk: /dev/sdb  (Size 10 GB)
VG: vg_root on /dev/sdb
THIN_POOL thin_pool occupying the whole physical extent
lvcreate -y --extents 100%free --thin vg_root/thin_pool

Thin volume on the thin pool
lvcreate --name lv_1 --virtualsize 1GB --thinpool vg_root/thin_pool

Another thin volume on the thin_pool
lvcreate --name lv_2 --virtualsize 2GB --thinpool vg_root/thin_pool
mount and create a file of 1 GB on the volume

Snapshot volume for lv_2
lvcreate -y --setactivationskip n --snapshot --thinpool vg_root/thin_pool vg_root/lv_2 --name snapshot_1
mount and create a file of 250MB on the volume

I assume the actual used space by snapshot_1 will be 250MB and not (1GB + 250MB). Is there a way to figure out the actual physical used space on snapshot_1 (250 MB).

thin_dump -f xml /dev/mapper/vg_root_thin_pool_tmeta

I will continue with on the same question, as these could be linked. Let me know if need to seperate out the next question:

dumps information about the logical volumes.

 begin superblock: "", 3, 8, 128, 326976
 device: 1
 mapped_blocks: 60
 transaction: 0
 creation time: 0
 snap time: 0
    (0..1) -> (0..1), 0
    2047 -> 58, 0
    4094 -> 57, 0
    6141 -> 52, 0

How do we map the device id to the lvm volume ?

undefine
  • 956
  • 8
  • 20
gudge
  • 199
  • 1
  • 10
  • 1
    `lvs` will tell you how much space each is using. – psusi Nov 01 '15 at 23:38
  • @psusi : I just see the virtual size with lvs. Could you please let me know the exact command. – gudge Nov 01 '15 at 23:40
  • Look at the column labeled "data %" – psusi Nov 02 '15 at 23:43
  • data % is inherited from origin volume. so - if origin volume is 50% full, every snapshot of it will be 50% full too - even if it doesn't occupy any blocks more. – undefine Jan 02 '17 at 08:31
  • @undefine not true. Data% column represents the "allocated to snapshot" size. it's confirmed by lvdisplay "Allocated to snapshot" property that will have the very same value. You can see it starting at 0.00% and growing as the time passes by – godzillante Aug 01 '17 at 10:36
  • @godzillante when you do snapshot for thin volume there is no dufference between snapshot and "master line". So data is inherited from origin volume. – undefine Aug 01 '17 at 14:22
  • @undefine I'm not sure, but I just took a 20GB snapshot of a 600GB volume. at start it was a 0.00%, after 15 minutes it was at 0.36%. It was a thick volume though. – godzillante Aug 01 '17 at 18:00
  • thick volumes works in other way. For thin volume look: https://pastebin.com/3xA0cJN1. If you use "fstrim" function - you can decrease it on snapshot - but if you fill it after it - i don't know any way to check how many space is is used by this specific snapshot (how many blocks are used only by this one volume) – undefine Aug 03 '17 at 09:09
  • There is new tool called thin_ls.It does give you the information. – gudge Aug 03 '17 at 12:55

0 Answers0