I have a shiny new computer with a not-that-large SSD (120GB) and two gigantic spinning-rust HDs (3TB each). I want to partition it as follows:
- swap (~128GB), operating system (~128GB), and data (all the rest) partitions striped across the HDs
- tiny boot partition on the SSD
- all the rest of the SSD's space is used for a cache pool
- the cache pool should be shared among all of the HD partitions, except maybe not the swap
I tried to do this with lvmcache and ran into the following problems:
-
If you just create a cache pool in the obvious way (as described e.g. here) you can only assign that to cache a single origin LV. So I could have it for the OS or for the data, but not both.
-
I tried to work around that by creating a "thin pool" spanning all of the HDs, thinking that I could cache the entire thin pool, then assign OS and data LVs out of that, but got told that it is not possible to cache a thin pool. (The
lvmthin
manpage doesn't make a hell of a lot of sense, it is possible that I did that part wrong.)
I am out of ideas. Can anyone suggest how to make this work? Note that I am not married to lvm, if bcache+plain MD (for the striping) can do this, or some other tool I don't know about, then that would be Just Fine Too.
Best Answer
You can create cached volume and convert it to thin-pool.
cache pool (cache data + cache metadata) -> cached volume (cache pool + original big slow volume) -> cached thin-pool
In this example vg0 is your volume group with physical volumes /dev/small-fast-disk and /dev/big-slow-disk. All logical volumes must be in the same volume group.
create cachepool volume (cache data and cache metadata in one command)
create cache volume
convert cached volume to thin volume