Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to configure software RAID 5 on linux that uses system RAM for write cache? I have a file server with 8GB of RAM ... would be really cool if I could dedicate 4GB to write cache. If so, how is this done? Thanks.

share|improve this question
Note that any synchronous writes will still have to wait for the disks; this is more common than you'd think. – Chris S Mar 30 '11 at 2:32
Right that's fine -- but I'm looking to implement "write back" cache without purchasing an expensive hardware RAID controller. Is that possible? – ensnare Mar 30 '11 at 2:45
Just be aware that this is incredibly dangerous. Writes that are in your cache but have not been comitted to disk can (will) corrupt your data if power is lost unexpectedly (crash, pull out power plug, etc). Any decent RAID controller won't let you (or makes it really hard) to enable write cache unless you have a battery backup unit on the card itself, and there's a reason for that. – Mark Henderson Mar 30 '11 at 4:12
That makes a lot of sense. I have a UPS unit protecting the server and am hoping that can sufficiently protect the data. – ensnare Mar 30 '11 at 5:48
If you don't care about protecting your data against drive failure, then why not just use RAID0 and stripe it all the way across? – Avery Payne Jan 26 '14 at 3:23

That's kinda awkward due to read-write cache is always there in despite of having RAID or a single disk block device. But there's one knob which can add more RAM for RAID's own stripe-cache: /sys/block/mdYOUR_MD_NUMBER/md/stripe_cache_size

stripe_cache_size (currently raid5 only) number of entries in the stripe cache. This is writable, but there are upper and lower limits (32768, 16). Default is 128.

This knob is addressed to lower "partial write" performance issue, AFAIS. It's meaning is number of cache pages (4k) per every disk drive in RAID.

share|improve this answer
Thanks! What are the units, KB or MB? Seems that 32MB would be pretty small for a write cache? – ensnare Mar 30 '11 at 2:45
That's not MBs or KBs. As doc says: "number of entries in the stripe cache". You can check free -m before setting it to 32768 and after. You'll see. :) – poige Mar 30 '11 at 2:50
@ensnare, actually this is number of cache pages (4k) per every disk drive in RAID. – poige Sep 6 '12 at 6:24
Is it per data disk, or disks total? Since it's RAID5, you got N disks in array, but N-1 of data. – Marcin Sep 7 '12 at 13:09
@Marcin, N - 1 of data has nothing to do with it, since usual layout of RAID-5, for e. g., is parity spread across all of the disks. So it seems to be reasonable to assume literally per every disk drive of RAID. free -m before/after should tell for sure, though. – poige Sep 7 '12 at 15:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.