I have recently successfully setup bcache in my Fedora version 20 install. I am a brand new Fedora user here so bear with me. I'll try to describe how I did this here.
If your ssd is larger than 60GB, it probably only makes sense to use the first 64GB for your bcache, you'll likely not see any benefit to using a larger amount of ssd cache space and you can use the remaining ssd space for something more useful. Taking care of a larger ssd is done in step 4a below, if your ssd is 60GB or smaller, just skip step 4a.
You should assume that following this guide will leave you with only zeros in all of the drives attached to your machine. Also note that even if you get things set up properly here, you'll be in an inherantly precarious situation. Following this guide will have you running an experimental file system (btrfs) on an experimental caching system (bcache) which can be impacted by hardware errors on either one of two physical drives.
- Your machine is set up for BIOS type booting (not EFI, there are probably simple modifications you can make to get this to work under a EFI boot scenario, but I don't know them)
- /dev/sda is the rotating magnetic disk with nothing important on it you want to cache with a ssd
- /dev/sdb is your ssd with nothing important on it you intend to use as a cache for /dev/sda
Step #1: Boot from F20 live media.
Step #2: Choose "Try Fedora" and open a terminal.
Step #3: Install bcache tools and gparted.
sudo yum install bcache-tools gparted
- Create a new gpt partition table for /dev/sda (msdos works too but it's old and may cause problems later)
- Make a new partition: /dev/sda1 cleared, 2MiB, bios_grub flag set (this is needed to boot with BIOS from gpt disks)
- Make a new partition: /dev/sda2 ext4, 512MiB (this will be your /boot partition)
- Make a new partition: /dev/sda3 swap
- Make a new partition: /dev/sda4 cleared (this will be part of your bcache)
You should figure out the proper sizes for /dev/sda3 and /dev/sda4 yourself
Step #5: Repartition your SSD.
Still using gparted:
- Create a new gpt partition table for /dev/sdb (msdos works too but it's old and may cause problems later)
- Make a new partition: /dev/sdb1 cleared (this will be part of your bcache)
I recommend that if your ssd is larger than 64 GB you make /dev/sdb1 only 64 GB in size (making it bigger is probably a waste). You can use the rest of your ssd for someting else more useful.
Step #5.1: Remove any existing file systems on the targets.
In case you're not following this guide exactly and you have junk left over in your target partitions from something else, clean them up like this. You shouldn't need to do this if you just made them "unformatted" as described in steps 4 and 5 above
sudo wipefs -f -a /dev/sda4 sudo wipefs -f -a /dev/sdb
sudo make-bcache --wipe-bcache -w512 --discard --writeback -B /dev/sda4 -C /dev/sdb
Step #7: Put a file system in your bcache.
sudo mkfs.btrfs /dev/bcache0
Step #8: Start the Fedora installer
Step #9: Click some things in the installer
- Click the "Installation Destination" button
- select bcache0 and sda (black check marks)
- click "Full disk summary and bootloader..." in the lower left hand corner
- Make sure your hdd (NOT YOUR SSD) has a green check mark indicating that grub will be installed there
- Click the Done button (upper left corner)
- Choose BTRFS from the Partition scheme dropdown
- Select I want to review/modify my disk partitions before continuing.
- Click the Continue button
- Expand Unknown
- Click the sda2 partition, set Mount point as /boot, check Reformat, Click Update Settings button
- Click the swap partition, check Reformat, Click Update Settings button
- Click the sda1 partition, check Reformat, Click Update Settings button
- Click the Plus (+) button in the lower left, select "/" for Mount Point:, click Add mount point button, Choose btrfs... in the Volume: dropdown menu, Click Update Settings button
- Click the Plus (+) button in the lower left, select "/home" for Mount Point:, click Add mount point button, Choose Btrfs 1.1 in the Volume: dropdown menu, check Reformat, Click Update Settings button
- Click the Done button (upper left corner)
- Click the Accept Changes button
Step #12: Chroot into your new install.
Once the install has completed,
sudo chroot /mnt/sysimage
yum install bcache-tools
Step #14: Rebuild initramfs.
yum update kernel
Step #15: Reboot into your new bcached system.
That's it, just 15 easy steps!
You should now have a fully functioning system. All of this should be one-time and you should never have to do any of this again for this install.
Note you can get various performance stats on your bcache like this
Also you can see this article: https://ask.fedoraproject.org/en/question/41664/optimization-for-an-ssd/