From Fedora Project Wiki

This is important
This page is still Work In Progress, and needs correcting.


Description

This page describes a test case for bcache-tools; "mock on bcache without using LVM".

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 and dracut.

Assuming you have a fresh Fedora 20 system is running, we will create mock partitions to a bcache device.

Prerequisites

The prerequisites for running the bcache-tools testcases can be found on this page

Setup

  1. Open terminal
  2. Switch to root user: su -

First of all we have to make sure no traces of bcache superblocks are left on /dev/sdb1 from earlier experiments. So before installing bcache-tools do the following:

  1. update util-linux to the latest version (2.24 is required): yum update util-linux
  2. Wipe whatever is on the /dev/sdb1 partition: wipefs -a /dev/sdb1
  3. Wipe whatever is on the /dev/sdb2 partition: wipefs -a /dev/sdb2
  4. Next install bcache-tools: yum install bcache-tools
  5. reboot so bcache-tools is processed well

How to test

  1. Add two new partitions w/ gnome-disks or gparted or the same
  2. Erase the old /var/lib/mock from /dev/sda2: wipefs -a /dev/sda2
  3. Erase the old /var/cache/mock from /dev/sda3: wipefs -a /dev/sda3
  4. Make /dev/sda2 a bcache backing device: make-bcache -B /dev/sda2
  5. Make /dev/sda3 a bcache backing device: make-bcache -B /dev/sda3
  6. Make /dev/sdb1 a bcache caching device: make-bcache -C /dev/sdb1
  7. Make /dev/sdb2 a bcache caching device: make-bcache -C /dev/sdb2
  8. Retrieve the cset.uuid from your /dev/sdb1 caching device: bcache-super-show /dev/sdb1
  9. Attach /dev/sdb1 to /dev/bcache0: echo <cset.uuid> > /sys/block/bcache0/bcache/attach
  10. Retrieve the cset.uuid from your /dev/sdb2 caching device: bcache-super-show /dev/sdb2
  11. Attach /dev/sdb1 to /dev/bcache1: echo <cset.uuid> > /sys/block/bcache1/bcache/attach

Now you have a bcache device: /dev/bcache0 and /dev/bcache1

  1. use "bcache-status -s" to see details about your bcache device.
  2. create a filesystem: mkfs -t ext4 -L MOCK_LIB /dev/bcache0
  3. create a filesystem: mkfs -t ext4 -L MOCK_CACHE /dev/bcache1
  4. create a /var/lib/mock entry in your /etc/fstab: LABEL=MOCK_LIB /var/lib/mock ext4 defaults 1 2
  5. create a /var/cache/mock entry in your /etc/fstab: LABEL=MOCK_CACHE /var/cache/mock ext4 defaults 1 2
  6. mount partitions: mount -a
  7. reboot your system to see if it boots OK.
  8. do some other tests generating I/O on mock partitions (two or more times).
$ fedpkg clone gnome-shell
$ cd gnome-shell
$ fedpkg srpm
$ mock -r fedora-20-`arch` --rebuild *.src.rpm --verbose

Expected Results

  1. All steps complete without errors
  2. Last step after second replay should installing packages too much faster