Lines Matching refs:bcache

2 A block layer cache (bcache)
6 nice if you could use them as cache... Hence bcache.
8 The bcache wiki can be found at:
9 https://bcache.evilpiepirate.org
11 This is the git repository of bcache-tools:
12 https://git.kernel.org/pub/scm/linux/kernel/git/colyli/bcache-tools.git/
14 The latest bcache kernel code can be found from mainline Linux kernel:
26 doesn't even have a notion of a clean shutdown; bcache simply doesn't return
47 You'll need bcache util from the bcache-tools repository. Both the cache device
50 bcache make -B /dev/sdb
51 bcache make -C /dev/sdc
53 `bcache make` has the ability to format multiple devices at the same time - if
57 bcache make -B /dev/sda /dev/sdb -C /dev/sdc
59 If your bcache-tools is not updated to latest version and does not have the
60 unified `bcache` utility, you may use the legacy `make-bcache` utility to format
61 bcache device with same -B and -C parameters.
63 bcache-tools now ships udev rules, and bcache devices are known to the kernel
66 echo /dev/sdb > /sys/fs/bcache/register
67 echo /dev/sdc > /sys/fs/bcache/register
69 Registering the backing device makes the bcache device show up in /dev; you can
70 now format it and use it as normal. But the first time using a new bcache
72 If you are thinking about using bcache later, it is recommended to setup all your
73 slow devices as bcache backing devices without a cache, and you can choose to add
79 /dev/bcache<N>
83 /dev/bcache/by-uuid/<uuid>
84 /dev/bcache/by-label/<label>
91 You can control bcache devices through sysfs at /sys/block/bcache<N>/bcache .
92 You can also control them through /sys/fs//bcache/<cset-uuid>/ .
96 cache set shows up as /sys/fs/bcache/<UUID>
104 /sys/fs/bcache::
106 echo <CSET-UUID> > /sys/block/bcache0/bcache/attach
109 your bcache devices. If a backing device has data in a cache somewhere, the
110 /dev/bcache<N> device won't be created until the cache shows up - particularly
116 echo 1 > /sys/block/sdb/bcache/running
120 partition, the bcache directory would be at /sys/block/sdb/sdb2/bcache)
154 A) Starting a bcache with a missing caching device
159 host:~# echo /dev/sdb1 > /sys/fs/bcache/register
160 [ 119.844831] bcache: register_bcache() error opening /dev/sdb1: device already registered
164 start your bcache without its cache, like so::
166 host:/sys/block/sdb/sdb1/bcache# echo 1 > running
173 host:/sys/block/md5/bcache# echo 0226553a-37cf-41d5-b3ce-8b1e944543a8 > attach
174 [ 1933.455082] bcache: bch_cached_dev_attach() Couldn't find uuid for md5 in set
175 [ 1933.478179] bcache: __cached_dev_store() Can't attach 0226553a-37cf-41d5-b3ce-8b1e944543a8
181 host:/sys/block/md5/bcache# echo /dev/sdh2 > /sys/fs/bcache/register
184 C) Corrupt bcache crashes the kernel at device registration time:
187 Please report it to the bcache development list: linux-bcache@vger.kernel.org
193 D) Recovering data without bcache:
195 If bcache is not available in the kernel, a filesystem on the backing
198 --data-offset when you originally formatted bcache with `bcache make`.
215 16 bytes were erased at offset 0x1018 (bcache)
218 After you boot back with bcache enabled, you recreate the cache and attach it::
220 host:~# bcache make -C /dev/sdh2
230 [ 650.511912] bcache: run_cache_set() invalidating existing data
231 [ 650.549228] bcache: register_cache() registered cache device sdh2
235 host:/sys/block/md5/bcache# echo 1 > running
239 host:/sys/block/md5/bcache# echo 5bc072a8-ab17-446d-9744-e247949913c1 > attach
240 …[ 865.276616] bcache: bch_cached_dev_attach() Caching md5 as bcache0 on set 5bc072a8-ab17-446d-97…
245 host:/sys/block/sda/sda7/bcache# echo 1 > detach
246 [ 695.872542] bcache: cached_dev_detach_finish() Caching disabled for sda7
254 host:/sys/fs/bcache/b7ba27a1-2398-4649-8ae3-0959f57ba128# ls -l cache0
255 …ache0 -> ../../../devices/pci0000:00/0000:00:1d.0/0000:70:00.0/nvme/nvme0/nvme0n1/nvme0n1p4/bcache/
256 host:/sys/fs/bcache/b7ba27a1-2398-4649-8ae3-0959f57ba128# echo 1 > stop
257 …kernel: [ 917.041908] bcache: cache_set_free() Cache set b7ba27a1-2398-4649-8ae3-0959f57ba128 unr…
262 …/dev/nvme0n1p4: 16 bytes were erased at offset 0x00001018 (bcache): c6 85 73 f6 4e 1a 45 ca 82 65 …
265 G) dm-crypt and bcache
267 First setup bcache unencrypted and then install dmcrypt on top of
268 /dev/bcache<N> This will work faster than if you dmcrypt both the backing
269 and caching devices and then install bcache on top. [benchmarks?]
272 H) Stop/free a registered bcache to wipe and/or recreate it
274 Suppose that you need to free up all bcache references so that you can
278 1) Is it present in /dev/bcache* ? (there are times where it won't be)
282 host:/sys/block/bcache0/bcache# echo 1 > stop
286 host:/sys/block/bcache0# cd bcache
287 bash: cd: bcache: No such file or directory
290 references this bcache to free it up::
293 bcache: bcache_device_free() bcache0 stopped
294 bcache: cache_set_free() Cache set 5bc072a8-ab17-446d-9744-e247949913c1 unregistered
296 This causes the backing bcache to be removed from /sys/fs/bcache and
298 where bcache is a lower device.
300 3) In other cases, you can also look in /sys/fs/bcache/::
302 host:/sys/fs/bcache# ls -l */{cache?,bdev?}
303 … 5 09:39 0226553a-37cf-41d5-b3ce-8b1e944543a8/bdev1 -> ../../../devices/virtual/block/dm-1/bcache/
304 … 5 09:39 0226553a-37cf-41d5-b3ce-8b1e944543a8/cache0 -> ../../../devices/virtual/block/dm-4/bcache/
305 …devices/pci0000:00/0000:00:01.0/0000:01:00.0/ata10/host9/target9:0:0/9:0:0:0/block/sdl/sdl2/bcache/
310 host:/sys/fs/bcache/5bc072a8-ab17-446d-9744-e247949913c1# echo 1 > stop
312 This will free up bcache references and let you reuse the partition for
326 The default metadata size in bcache is 8k. If your backing device is
328 width using `bcache make --data-offset`. If you intend to expand your
349 # echo writeback > /sys/block/bcache0/bcache/cache_mode
353 By default, bcache doesn't cache everything. It tries to skip sequential IO -
361 # echo 0 > /sys/block/bcache0/bcache/sequential_cutoff
365 # echo 4M > /sys/block/bcache0/bcache/sequential_cutoff
374 To avoid that bcache tracks latency to the cache device, and gradually
380 # echo 0 > /sys/fs/bcache/<cache set>/congested_read_threshold_us
381 # echo 0 > /sys/fs/bcache/<cache set>/congested_write_threshold_us
394 this to not show up enough to be noticeable (especially since bcache's btree
406 Available at /sys/block/<bdev>/bcache, /sys/block/bcache*/bcache and
407 (if attached) /sys/fs/bcache/<cset-uuid>/bdev*
436 1 if bcache is running (i.e. whether the /dev/bcache device exists, whether
445 If non zero, bcache keeps a list of the last 128 requests submitted to compare
465 Write to this file to shut down the bcache device and close the backing
474 If nonzero, bcache tries to keep around this percentage of the cache dirty by
480 writeback is throttled to this rate. Continuously adjusted by bcache but may
499 Hits and misses are counted per individual IO as bcache sees them; a
517 Available at /sys/fs/bcache/<cset-uuid>
610 Available at /sys/block/<cdev>/bcache
650 the cache that doesn't contain any data. Metadata is bcache's
656 btree_written gives the amount of write inflation in bcache.