3

In linux mdadm man page I saw the option "--write-journal".

How does this relate to lvmcache as lvmcache is built on top of dm-cache? Are they different things or does lvmcache do something like "--write-journal" under the hood?

Thanks!

user220574
  • 63
  • 4

1 Answers1

5

The RAID journal is described in more detail in the md manpage:

   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.

So - this is not related to lvmcache in any way, shape or form whatsoever.

lvmcache is meant to provide faster reads by caching data on SSD

md write journal is a write cache and it doesn't even make things faster. It exists to prevent data loss. And it is a huge burden to the SSD if all RAID writes first have to go through it - if this also happens during RAID resyncs and grows, you'd be looking at many terabytes written in a short timeframe.

Which might be why mdadm manpage mentions SSD lifetime:

   --write-journal
          Specify  journal  device  for  the RAID-4/5/6 array. The journal
          device should be a SSD with reasonable lifetime.
frostschutz
  • 47,228
  • 5
  • 112
  • 159