为现有 LVM 添加缓存

为现有 LVM 添加缓存

我的 AlmaLinux 9.3 服务器当前使用 LVM。

一个 VG 映射到系统 SSD 驱动器,由两个 LV、root 和 swap 组成。这样就没问题了。

一个 VG 由三个硬盘组成,称为 Vault。它只是数据存储,安装在 /vault 上。如果服务器上运行的 Docker 服务关闭,则可以禁用 LV,而不会干扰基本操作系统。

最近,我目睹了许多特定情况下的 wa in top。解决此问题的一个廉价方法是为现有 LVM 存储库配置引入 SSD 缓存。购买 SSD 驱动器(尚未安装)后,我意识到大多数指南都描述了在安装时集成缓存的过程。我查看了 RHEL、这个非常好的书面概述(来自德国 IT 博客)和其他类似的指南。其中大多数都警告说,在现有 LVM 中引入缓存驱动器时,存储库中现有的数据将丢失。

我已经将保险库扩展了两次,但是没有使用缓存。

有人能分享一下他们这样做的经验或指出正确的文档吗?我没有足够的外部存储空间来备份所有数据。我只备份了关键内容,但丢失其他数据会非常烦人。

相关输出

pvdisplay:
--- Physical volume ---
  PV Name               /dev/sdc2
  VG Name               system
  PV Size               207.88 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              53217
  Free PE               0
  Allocated PE          53217
  PV UUID               JUC0bk-nF8l-YQmR-GZnn-zzvo-pes3-t6rjud
   
  --- Physical volume ---
  PV Name               /dev/sdd1
  VG Name               vault
  PV Size               <9.10 TiB / not usable 2.98 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              2384383
  Free PE               0
  Allocated PE          2384383
  PV UUID               oSUiba-13Zq-Ug7I-Ggwk-aCs4-HeIy-mL8b55
   
  --- Physical volume ---
  PV Name               /dev/sda
  VG Name               vault
  PV Size               <7.28 TiB / not usable <1.34 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              1907721
  Free PE               0
  Allocated PE          1907721
  PV UUID               W3nnD4-LbDZ-krY8-KVOZ-jnl0-1Khb-C56F6W
   
  --- Physical volume ---
  PV Name               /dev/sdb
  VG Name               vault
  PV Size               <20.01 TiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              5245439
  Free PE               0
  Allocated PE          5245439
  PV UUID               1YIaLl-DRtM-vMAS-1SKb-6iUg-87Gv-2BgnJ1

vgdisplay:
  --- Volume group ---
  VG Name               system
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <207.88 GiB
  PE Size               4.00 MiB
  Total PE              53217
  Alloc PE / Size       53217 / <207.88 GiB
  Free  PE / Size       0 / 0   
  VG UUID               BHmjRL-1pC6-Y5FY-tDBd-ID5P-Vvcl-jvmpzA
   
  --- Volume group ---
  VG Name               vault
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               36.38 TiB
  PE Size               4.00 MiB
  Total PE              9537543
  Alloc PE / Size       9537543 / 36.38 TiB
  Free  PE / Size       0 / 0   
  VG UUID               Bi5H7i-FWY5-kMEN-K7aK-0NST-TKjP-sZnpMY

lvdisplay:
 --- Logical volume ---
  LV Path                /dev/system/root
  LV Name                root
  VG Name                system
  LV UUID                Ju9Hve-q3xe-YYa7-msvG-EelX-wQdh-vrMrcS
  LV Write Access        read/write
  LV Creation host, time core, 2023-01-03 15:00:41 +0100
  LV Status              available
  # open                 1
  LV Size                <191.88 GiB
  Current LE             49121
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/system/swap
  LV Name                swap
  VG Name                system
  LV UUID                SVDs7q-QjNu-LN1W-4Bjm-psC3-kXbH-l6SdZa
  LV Write Access        read/write
  LV Creation host, time xxx, 2023-01-03 15:00:41 +0100
  LV Status              available
  # open                 2
  LV Size                16.00 GiB
  Current LE             4096
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/vault/vault
  LV Name                vault
  VG Name                vault
  LV UUID                Gxzis5-NCCX-FhQa-e2rv-FNcn-nQpt-7Ni0fV
  LV Write Access        read/write
  LV Creation host, time xxx, 2019-06-04 22:07:37 +0200
  LV Status              available
  # open                 1
  LV Size                36.38 TiB
  Current LE             9537543
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

答案1

您的系统上有正确的文档man lvmcache。还有 RHEL 文档启用缓存以提高逻辑卷性能

如果您不确定,您可以随时在 VM 中尝试该过程。

并且始终备份您的数据。

相关内容