9

Say I have some partitions; one on a SATA drive and one on an SSD. I want to create a "virtual" hybrid disk. Is this possible?

5 Answers 5

10

bcache might be what you are looking for. It can act as write through or write back cache.

ZFS and Btrfs also have features to put more often used blocks on flash storage.

5

If you have a set of files for which you need low latency, you can establish a RAID-1 volume that mirrors the SSD content on a hard disk. Declare the hard disk component as “write-mostly”, so that the SSD will be favored when reading. For example, if sda is your SSD and sdb is your hard disk, create a partition sda1 that covers the whole drive, create a partition sdb1 of the same size, and create a RAID volume with

mdadm --create -l 1 -n 2 /dev/md0 /dev/sda1 --write-mostly /dev/sdb1 
2
  • This is seriously a good catch. It's a straight answer to this on AU: Can I cache an mdadm raid with an ssd? (in which I now mentioned your answer in mine) Commented Feb 6, 2013 at 21:17
  • Note this means the array obviously needs to include the SSD, so using a 120GB SSD with a 2TB HDD is going to get you a 120GB array -- not what people are usually after when they want SSD caching. Commented Sep 5, 2019 at 22:41
4

There is flashcache. It is used by Facebook to accelerate DB-storage systems.

I haven't tried it yet, so your mileage may vary.

2

Since Linux 3.9 dm-cache has been merged into the mainline tree. As per the documentation, it's specifically designed for this purpose.

It aims to improve performance of a block device (eg, a spindle) by dynamically migrating some of its data to a faster, smaller device (eg, an SSD).

It will also provide write caching to some extend:

If writeback, the default, is selected then a write to a block that is cached will go only to the cache and the block will be marked dirty in the metadata.

About the virtual hybrid disk you'd like to see:

This device-mapper solution allows us to insert this caching at different levels of the dm stack, for instance above the data device for a thin-provisioning pool.

In other words, the dm-stack lets you use any block device/partition to become a single cached virtual disk as a storage device, just like a /dev/md0 in a software raid set.

2

LVM also allows this:

Hybrid volumes can be created using the dm-cache target, which allows one or more fast storage devices, such as flash-based SSDs, to act as a cache for one or more slower hard disk drives.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.