如何获取 LVM 精简快照 thin_delta 的快照数字标识符

如何获取 LVM 精简快照 thin_delta 的快照数字标识符

我希望能够运行thin_delta。我可以成功运行thin_dumpthin_ls但是我不明白如何获取手册页中提到的数字快照标识符。

--thin1, --snap1 {natural}
  The numeric identifier for the first thin volume to diff.

我希望能够做到以下同等的事情:

dmsetup message /dev/mapper/volg-volg--thinpool-tpool 0 reserve_metadata_snap

# Works, but what do 1 and 2 refer to?
thin_delta --verbose -m --snap1 1 --snap2 2 /dev/mapper/volg-volg--thinpool_tmeta

# Looks nice but doesn't work
thin_delta  -m --snap1 volg/thin_volume_snap2 --snap2 volg/thin_volume_snap3 /dev/mapper/volg-volg--thinpool_tmeta

dmsetup message /dev/mapper/volg-volg--thinpool-tpool 0 release_metadata_snap

LVS 的输出如下。

# lvs -a
  LV                    VG   Attr       LSize  Pool          Origin      Data%  Meta%  Move Log Cpy%Sync Convert
  [lvol0_pmspare]       volg ewi------- 12.00m                                                                  
  thin_volume           volg Vwi-a-tz--  6.00g volg-thinpool             31.96                                  
  thin_volume_snap1     volg Vwi---tz-k  6.00g volg-thinpool thin_volume                                        
  thin_volume_snap2     volg Vwi---tz-k  6.00g volg-thinpool thin_volume                                        
  thin_volume_snap3     volg Vwi---tz-k  6.00g volg-thinpool thin_volume                                        
  volg-thinpool         volg twi-aotz--  9.80g                           20.51  9.41                            
  [volg-thinpool_tdata] volg Twi-ao----  9.80g                                                                  
  [volg-thinpool_tmeta] volg ewi-ao---- 12.00m                                                                  

答案1

我研究出了如何做到这一点:

lvs --noheadings -o thin_id volg/thin_volume_snap4

我正在添加有关 thin_delta 和 thin_dump 的更多文档https://github.com/davidbartonau/lvm-thin-sendrcv

# Get the device IDs
SNAP1_ID=$(lvs --noheadings -o thin_id volg/thin_volume_snap4)
SNAP2_ID=$(lvs --noheadings -o thin_id volg/thin_volume_snap5)

# Reserve the metadata
dmsetup message /dev/mapper/volg-volg--thinpool-tpool 0 reserve_metadata_snap

# Determine the difference between the snapshots
thin_delta  -m --snap1 $SNAP1_ID --snap2 $SNAP2_ID /dev/mapper/volg-volg--thinpool_tmeta

# Release the metadata snapshot.  Try to keep this window short.
dmsetup message /dev/mapper/volg-volg--thinpool-tpool 0 release_metadata_snap

相关内容