# dm-cache howto?

## pa1983

I ordered a Samsung 840 120Gb SSD yesterday for use as system drive and a fast cache for temporary files in /tmp. Then I read that bcache and now dm-cache is in the kernel. I have periodically been looking out for something like this for linux.

bcache seems destructive sens I dont want to format my hard drives (seems necessary according to the guide I read here some where) in my filserver. Its a privet filserver, I run most of my storage there so I can easily share it between computers.

Basically what I am looking for is for the SSD to work as a cache when writing. I have 13 drives and when i get the SSD, 12 of 13 will be at sleep when not in use, currently one serves as OS drive and is spun up at all times.

I have most of my disks on 3 or 6 Gbit controllers on PCI-E  but due to cost and the problem of finding cost effective 4 port cards I have some drives on slow SIL3114 PCI controllers that I have had for ages so there limited to 35-80Mb/sec in practice depending on the disks workload.

This coupled with the sleep mode on the drives would make a 64Gb ssd cache wonderful to have. I transfer one 1-25Gb files at a time that could be cached so transfer could begin instantaneously and the SSD would hide the HDD write lagging behind. My user pattern is to copy a file from one temporary storage disk to the disk that will permanently store it for later use and the temporary storage drive is always spinning so Im always waiting for the permanent storage drive to wake up and also be fast enough. Then when I need the file for later use I recover it from its permanent storage drive. That would realy make the server feel faster on some of the slower controller and 5400rpm drives. I do have faster 3Tb 7200rpm drives on sata 6Gbit controller peaking at 170Mb/sec+. But a overall nicer and more predictable performance when writing no matter  what disk or controller is in use is what I want sens its about 50/50 now slow or fast and the slow one always keeps the fast once behind. I dont realy need a ssd read cache, basically once the cache is dumped to the HDD, preferably as fast as the harddrive can manage I would like the cache to be empty. I have to much data for it to be likley that I would read what ever was just written so a read cache makes little sens from what I can think off. Would also be nice to know that files are always synced to the drive asap so theres little risk of data loss in case of a system failure.

I dont know if dm-cache can do this and there is no gentoo wiki for it what I can see.

Also Im no hardcore linux user, been using gentoo for 12 years but Im still a bit of a noob sens I use the OS to get what I want done not fiddle around all day. I usualy fix most of my own problems with the help of howtos but in this case information for amateurs seems a bit limited.

So if you have anything to contribute or just have similar questions/ideas/problems as me pleas post. Might be useful to me or some on else.

----------

## Mark Knecht

Hi,

   I'm curious as to whether you made headway with this project as I'm looking at doing the same thing myself. Currently I'm leaning toward dm-cache. I'm just trying to convince myself that doing this won't put the whole machine at risk.

   If you're not away this month's Linux Journal (Sept. 2013) has an article on the subject comparing dm-cache, Flashcache & RapidDisk/RapidCache. bcache & EnhanceIO are mentioned as other technologies worth watching. It's worth the time to read it.

HTH,

Mark

----------

## pa1983

I have used gentoo since 2001 but Im pretty much a noob still. My software interest is not that big, Im more in to the hardware part but gentoo fits the software package I need very well to support the hardware and I understand enough to fallow most guides and understand the mechanics.

I found a few guides before I posted but they basically where experimental guides and they didn't recommend using it with out backup and I honestly did not understand everything. I would prefer if it was more integrated and simplified a bit and a bit more failsafe. Im mostly looking for a cache function to buffer writes, reads if its cached during a write but no cache function for the most used data since that for me usually is the most recently written data any way. Also I would like it to be failsafe and not corrupt any hard drives if not unmounted properly. Since I want a write trough cache I think its called I figure that should be possible but I dont know how dm-cache works on a low level since Im no developer nor programmer.

Im still hoping there will be a gentoo guide for it one day that makes sense.

----------

