结合 LVM 缓存和镜像

结合 LVM 缓存和镜像

我为 home_1 LV 设置了 LVM 缓存,我想将其镜像到新的 PV。当我运行 lvconvert 时,出现错误“无法转换 LV myvg/home_1_corig。”

是否可以将缓存和镜像结合起来?如果可以,正确的程序是什么?

# lvs -a -o +devices
  LV                    VG   Attr       LSize   Pool            Origin         Data%  Meta%  Move Log Cpy%Sync Convert Devices
  [cache_1_cpool]       myvg Cwi---C--- 882.81g                                1.07   16.19           0.00             cache_1_cpool_cdata(0)
  [cache_1_cpool_cdata] myvg Cwi-ao---- 882.81g                                                                        /dev/nvme1n1p5(12277)
  [cache_1_cpool_cmeta] myvg ewi-ao----  44.00m                                                                        /dev/nvme1n1p5(238277)
  home_1                myvg Cwi-aoC--- <10.92t [cache_1_cpool] [home_1_corig] 1.07   16.19           0.00             home_1_corig(0)
  [home_1_corig]        myvg owi-aoC--- <10.92t                                                                        /dev/sde1(0)
  [home_1_corig]        myvg owi-aoC--- <10.92t                                                                        /dev/sdd(0)
  ...


# pvs
  PV             VG            Fmt  Attr PSize    PFree
  /dev/nvme1n1p5 myvg lvm2 a--   931.02g 172.00m
  /dev/sda       myvg lvm2 a--    10.91t  10.91t
  /dev/sdc5      myvg lvm2 a--  <931.27g      0
  /dev/sdd       myvg lvm2 a--    <5.46t      0
  /dev/sde1      myvg lvm2 a--    <5.46t      0


# lvconvert -m1 myvg/home_1 /dev/sda
  Cannot convert LV myvg/home_1_corig.

更新

经过进一步检查,可以清楚地发现 sda 的大小略小于 sdd + sde1 的大小。减小 home_1 的大小解决了这个问题。

# lvconvert --uncache myvg/home_1
# umount /home
# lvreduce -r -L -8G myvg/home_1
# lvconvert -m1 myvg/home_1 /dev/sda
# lvcreate -n cache_1 -L 882.81g myvg /dev/nvme1n1p5
# lvconvert --type cache --cachemode writethrough --cachepool cache_1 myvg/home_1
# lvs -a -o +devices

  LV                      VG   Attr       LSize   Pool            Origin         Data%  Meta%  Move Log Cpy%Sync Convert Devices
  [cache_1_cpool]         myvg Cwi---C--- 882.81g                                0.01   16.19           0.00             cache_1_cpool_cdata(0)
  [cache_1_cpool_cdata]   myvg Cwi-ao---- 882.81g                                                                        /dev/nvme1n1p5(12277)
  [cache_1_cpool_cmeta]   myvg ewi-ao----  44.00m                                                                        /dev/nvme1n1p5(238277)
  home_1                  myvg Cwi-a-C--- <10.91t [cache_1_cpool] [home_1_corig] 0.01   16.19           0.00             home_1_corig(0)
  [home_1_corig]          myvg rwi-aoC--- <10.91t                                                       2.29             home_1_corig_rimage_0(0),home_1_corig_rimage_1(0)
  [home_1_corig_rimage_0] myvg iwi-aor--- <10.91t                                                                        /dev/sdd1(0)
  [home_1_corig_rimage_0] myvg iwi-aor--- <10.91t                                                                        /dev/sdc(0)
  [home_1_corig_rimage_1] myvg Iwi-aor--- <10.91t                                                                        /dev/sda(1)
  [home_1_corig_rmeta_0]  myvg ewi-aor---   4.00m                                                                        /dev/sdc(1428487)
  [home_1_corig_rmeta_1]  myvg ewi-aor---   4.00m                                                                        /dev/sda(0)

相关内容