Basic Bcache Operations
- Create bcache backend and cache drives.
1make-bcache -B /dev/sdx1 -C /dev/sdx2
-B: specifies a backend drive (data drive).
-C: specifies a cache device (for accelerating the data drive).
Example: Create backend drive sdb and cache device sdc.
1make-bcache -B /dev/sdb -C /dev/sdc

- Delete a cache drive.
- View the cset-uuid of a cache drive.
1bcache-super-show /dev/sd*Example: View the cache device sdc.
1bcache-super-show /dev/sdc
- Clear the cache.
1echo $cset-uuid > /sys/block/bcache<n>/bcache/detach
Example: Delete the cache drive whose cset-uuid is 5f50eddf-69d8-45e3-9b67-7386ffdaceb7.
1echo 5f50eddf-69d8-45e3-9b67-7386ffdaceb7 > /sys/block/bcache0/bcache/detach
Then sdc is detached from bcache0.
To re-attach the cache, run the following command:
1echo cset-uuid > /sys/block/bcache<n>/bcache/attach
- View the cset-uuid of a cache drive.
- Deregister a cache drive.
1echo 1 > /sys/fs/bcache/<cset-uuid>/unregister
Example: Deregister the cache drive whose cset-uuid is 5f50eddf-69d8-45e3-9b67-7386ffdaceb7.
1echo 1 > /sys/fs/bcache/5f50eddf-69d8-45e3-9b67-7386ffdaceb7/unregister
- Disable a cache drive.
1echo 1 > /sys/fs/bcache/<cset-uuid>/stop
Example: Disable the cache drive whose cset-uuid is 5f50eddf-69d8-45e3-9b67-7386ffdaceb7.
1echo 1 > /sys/fs/bcache/5f50eddf-69d8-45e3-9b67-7386ffdaceb7/stop
- Disable a backend device.
1echo 1 > /sys/block/bcache<n>/bcache/stop
Example: Disable the backend device whose n is 0.
1echo 1 > /sys/block/bcache0/bcache/stop
Then both sdb and sdc are detached from bcache0.

- Uninstall the bcache module.
After the uninstallation, the bcache module cannot be used. Exercise caution when performing this operation.
1rmmod bcache