linux "mdadm --write-journal" 和 lvmcache - 它们有什么关系?

use*_*574 3 raid mdadm lvm md

在 linux mdadm 手册页中,我看到了“--write-journal”选项。

这与 lvmcache 有什么关系,因为 lvmcache 是建立在 dm-cache 之上的?它们是不同的东西,还是 lvmcache 在幕后做了诸如“--write-journal”之类的事情?

谢谢!

fro*_*utz 5

RAID 日志在 md 联机帮助页中有更详细的描述:

   RAID456 WRITE JOURNAL

   Due to non-atomicity nature of RAID write operations,  interruption  of
   write  operations  (system  crash,  etc.)  to RAID456 array can lead to
   inconsistent parity and data loss (so called RAID-5 write hole).

   To plug the write hole, from Linux 4.4 (to be confirmed),  md  supports
   write  ahead  journal  for RAID456. When the array is created, an addi?
   tional journal device can be added to the array  through  write-journal
   option.  The  RAID write journal works similar to file system journals.
   Before writing to the data disks, md persists data AND  parity  of  the
   stripe  to  the  journal device. After crashes, md searches the journal
   device for incomplete write operations, and replay  them  to  the  data
   disks.

   When the journal device fails, the RAID array is forced to run in read-
   only mode.
Run Code Online (Sandbox Code Playgroud)

所以 - 这与lvmcache任何方式、形状或形式无关。

lvmcache 旨在通过在 SSD 上缓存数据来提供更快的读取

md write journal 是一个写缓存,它甚至不会让事情变得更快。它的存在是为了防止数据丢失。如果所有 RAID 写入都必须首先通过它,这对 SSD 来说是一个巨大的负担 - 如果在 RAID 重新同步和增长期间也发生这种情况,您将看到在短时间内写入了许多 TB。

这可能是mdadm联机帮助页提到 SSD 寿命的原因:

   --write-journal
          Specify  journal  device  for  the RAID-4/5/6 array. The journal
          device should be a SSD with reasonable lifetime.
Run Code Online (Sandbox Code Playgroud)