This page describes a test case for bcache-tools; "/home on bcache using LVM".
This page describes a test case for bcache-tools, Bcache is a Linux kernel block layer cache. It allows one or more fast disk drives such as flash-based solid state drives (SSDs) to act as a cache for one or more slower hard disk drives. The bcache-tools package contains the utilities for manipulating bcache
Testing covers not only bcache-tools but also the interaction between bcache-tools and other packages: kernel, util-linux, dracut and lvm2.
Once your fresh Fedora 20 system is running, we will "move" /home to a Logical Volume (LVM) on a bcache device. Because of the flexibility that LVM provides the approach is quite different from page 1.A, for example we'll start by using sda4!
The prerequisites for running the bcache-tools testcases can be found on this page
In this test case we'll need /dev/sda4 to build a new Volume Group on bcache.
Do the following steps:
- Open terminal
- Switch to root user:
First of all we have to make sure no traces of bcache superblocks are left on /dev/sda4 and /dev/sdb1. So before installing bcache-tools do the following:
- update util-linux to the latest version (2.24 is required):
yum update util-linux
- Wipe whatever is on the two partitions:
wipefs -a /dev/sda4
wipefs -a /dev/sdb1
- Next install bcache tools and lvm2:
yum install bcache-tools lvm2
- reboot so bcache-tools is processed well
How to test
Now create an use the bcache devices:
- Make /dev/sda4 a bcache backing device:
make-bcache -B /dev/sda4
- Make /dev/sdb1 a bcache caching device:
make-bcache -C /dev/sdb1
- Note the set uuid and attach /dev/sdb1 to /dev/sda2:
echo <set uuid> > /sys/block/bcache0/bcache/attach
Now you have a bcache device: /dev/bcache0
- use "bcache-status -s" to see details about your bcache device.
- create a Physical Volume:
- create a Volume Group:
vgcreate BCACHE /dev/bcache0
- create a Logical Volume:
lvcreate -L 2G -n HOME BCACHE
- create a filesystem:
mkfs -t ext4 -L HOME /dev/BCACHE/HOME
This will be our new /home device. To use it first move the current /home to another mount point:
- replace /home entry in your /etc/fstab:
LABEL=HOME /home ext4 defaults 1 2
- If needed copy your current /home to the new /home:
mount /dev/sda2 /home.old
cp -ax /home.old/* /home
- build a new initramfs with
Now you have a system with /home on LVM2 on bcache.
- reboot your system to see if it boots OK.
- do some other testing if you like.
- All steps complete without errors