Getting Started
You need three things to get going:
- A Solid State Drive (SSD) to act as a cache
- A kernel compiled with the bcache code (you can either use the linux-bcache git repository or bcache.patch. The patch may be a little older than the repo)
- The make-bcache program (in the bcache-tools repository)
The git repositories are git://evilpiepirate.org/~kent/linux-bcache.git and git://evilpiepirate.org/~kent/bcache-tools.git.
To get started, you'll need make-bcache from the tools repository. Set the bucket size to match your SSD's erase block size - for Intel SSDs this should be 128k, for most others I believe it's 512k. And if you're using a partition, you'll want it aligned to to an erase block boundary.
# make-bcache -b128k /dev/sdb1
Once you're running your shiny new kernel, bcache is controlled via sysfs. It indexes cached devices by their UUID, so data can safely persist across reboots even when device names change:
# echo "/dev/sdb1" > /sys/kernel/bcache/register_cache # echo "<UUID> /dev/md1" > /sys/kernel/bcache/register_dev
And you're up and running. One easy way to grab the UUID automatically is to use this form:
# echo "`blkid /dev/md1 -s UUID -o value` /dev/md1" > /sys/kernel/bcache/register_dev
To verify that bcache recognizes both new cache devices and new filesystems to cache, run:
dmesg | tail