diff options
author | Gabriel de Perthuis <g2p.code@gmail.com> | 2013-06-26 20:12:07 -0400 |
---|---|---|
committer | Kent Overstreet <koverstreet@google.com> | 2013-06-27 00:58:06 -0400 |
commit | cecd628d9a9966ed0af1237df5cc5818945fe9f2 (patch) | |
tree | 4e16213a32879a7ff52fb7344d8ddda492cf2b8b /Documentation | |
parent | ab9e14002e271eba41f7f9ab7e9b03cac4adc22d (diff) |
bcache: Refresh usage docs
Mention udev autoregistration, symlinks. Write down some sysfs paths.
Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
Signed-off-by: Kent Overstreet <koverstreet@google.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/bcache.txt | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/Documentation/bcache.txt b/Documentation/bcache.txt index c3365f26b2d9..32b6c3189d98 100644 --- a/Documentation/bcache.txt +++ b/Documentation/bcache.txt | |||
@@ -46,29 +46,33 @@ you format your backing devices and cache device at the same time, you won't | |||
46 | have to manually attach: | 46 | have to manually attach: |
47 | make-bcache -B /dev/sda /dev/sdb -C /dev/sdc | 47 | make-bcache -B /dev/sda /dev/sdb -C /dev/sdc |
48 | 48 | ||
49 | To make bcache devices known to the kernel, echo them to /sys/fs/bcache/register: | 49 | bcache-tools now ships udev rules, and bcache devices are known to the kernel |
50 | immediately. Without udev, you can manually register devices like this: | ||
50 | 51 | ||
51 | echo /dev/sdb > /sys/fs/bcache/register | 52 | echo /dev/sdb > /sys/fs/bcache/register |
52 | echo /dev/sdc > /sys/fs/bcache/register | 53 | echo /dev/sdc > /sys/fs/bcache/register |
53 | 54 | ||
54 | To register your bcache devices automatically, you could add something like | 55 | Registering the backing device makes the bcache device show up in /dev; you can |
55 | this to an init script: | 56 | now format it and use it as normal. But the first time using a new bcache |
57 | device, it'll be running in passthrough mode until you attach it to a cache. | ||
58 | See the section on attaching. | ||
56 | 59 | ||
57 | echo /dev/sd* > /sys/fs/bcache/register_quiet | 60 | The devices show up as: |
58 | 61 | ||
59 | It'll look for bcache superblocks and ignore everything that doesn't have one. | 62 | /dev/bcache<N> |
60 | 63 | ||
61 | Registering the backing device makes the bcache show up in /dev; you can now | 64 | As well as (with udev): |
62 | format it and use it as normal. But the first time using a new bcache device, | ||
63 | it'll be running in passthrough mode until you attach it to a cache. See the | ||
64 | section on attaching. | ||
65 | 65 | ||
66 | The devices show up at /dev/bcacheN, and can be controlled via sysfs from | 66 | /dev/bcache/by-uuid/<uuid> |
67 | /sys/block/bcacheN/bcache: | 67 | /dev/bcache/by-label/<label> |
68 | |||
69 | To get started: | ||
68 | 70 | ||
69 | mkfs.ext4 /dev/bcache0 | 71 | mkfs.ext4 /dev/bcache0 |
70 | mount /dev/bcache0 /mnt | 72 | mount /dev/bcache0 /mnt |
71 | 73 | ||
74 | You can control bcache devices through sysfs at /sys/block/bcache<N>/bcache . | ||
75 | |||
72 | Cache devices are managed as sets; multiple caches per set isn't supported yet | 76 | Cache devices are managed as sets; multiple caches per set isn't supported yet |
73 | but will allow for mirroring of metadata and dirty data in the future. Your new | 77 | but will allow for mirroring of metadata and dirty data in the future. Your new |
74 | cache set shows up as /sys/fs/bcache/<UUID> | 78 | cache set shows up as /sys/fs/bcache/<UUID> |
@@ -80,11 +84,11 @@ must be attached to your cache set to enable caching. Attaching a backing | |||
80 | device to a cache set is done thusly, with the UUID of the cache set in | 84 | device to a cache set is done thusly, with the UUID of the cache set in |
81 | /sys/fs/bcache: | 85 | /sys/fs/bcache: |
82 | 86 | ||
83 | echo <UUID> > /sys/block/bcache0/bcache/attach | 87 | echo <CSET-UUID> > /sys/block/bcache0/bcache/attach |
84 | 88 | ||
85 | This only has to be done once. The next time you reboot, just reregister all | 89 | This only has to be done once. The next time you reboot, just reregister all |
86 | your bcache devices. If a backing device has data in a cache somewhere, the | 90 | your bcache devices. If a backing device has data in a cache somewhere, the |
87 | /dev/bcache# device won't be created until the cache shows up - particularly | 91 | /dev/bcache<N> device won't be created until the cache shows up - particularly |
88 | important if you have writeback caching turned on. | 92 | important if you have writeback caching turned on. |
89 | 93 | ||
90 | If you're booting up and your cache device is gone and never coming back, you | 94 | If you're booting up and your cache device is gone and never coming back, you |
@@ -191,6 +195,9 @@ want for getting the best possible numbers when benchmarking. | |||
191 | 195 | ||
192 | SYSFS - BACKING DEVICE: | 196 | SYSFS - BACKING DEVICE: |
193 | 197 | ||
198 | Available at /sys/block/<bdev>/bcache, /sys/block/bcache*/bcache and | ||
199 | (if attached) /sys/fs/bcache/<cset-uuid>/bdev* | ||
200 | |||
194 | attach | 201 | attach |
195 | Echo the UUID of a cache set to this file to enable caching. | 202 | Echo the UUID of a cache set to this file to enable caching. |
196 | 203 | ||
@@ -300,6 +307,8 @@ cache_readaheads | |||
300 | 307 | ||
301 | SYSFS - CACHE SET: | 308 | SYSFS - CACHE SET: |
302 | 309 | ||
310 | Available at /sys/fs/bcache/<cset-uuid> | ||
311 | |||
303 | average_key_size | 312 | average_key_size |
304 | Average data per key in the btree. | 313 | Average data per key in the btree. |
305 | 314 | ||
@@ -390,6 +399,8 @@ trigger_gc | |||
390 | 399 | ||
391 | SYSFS - CACHE DEVICE: | 400 | SYSFS - CACHE DEVICE: |
392 | 401 | ||
402 | Available at /sys/block/<cdev>/bcache | ||
403 | |||
393 | block_size | 404 | block_size |
394 | Minimum granularity of writes - should match hardware sector size. | 405 | Minimum granularity of writes - should match hardware sector size. |
395 | 406 | ||