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.

link|improve this question

62% accept rate
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
3  
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
feedback

1 Answer

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.

link|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
feedback

Your Answer

 
or
required, but never shown

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