€•Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ&/translations/zh_CN/admin-guide/bcache”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/zh_TW/admin-guide/bcache”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/it_IT/admin-guide/bcache”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/ja_JP/admin-guide/bcache”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/ko_KR/admin-guide/bcache”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/pt_BR/admin-guide/bcache”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/sp_SP/admin-guide/bcache”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒA block layer cache (bcache)”h]”hŒA block layer cache (bcache)”…”�”}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³Œ@/var/lib/git/docbuild/linux/Documentation/admin-guide/bcache.rst”h´KubhŒ paragraph”“”)�”}”(hŒzSay you've got a big slow raid 6, and an ssd or three. Wouldn't it be nice if you could use them as cache... Hence bcache.”h]”hŒ~Say you’ve got a big slow raid 6, and an ssd or three. Wouldn’t it be nice if you could use them as cache... Hence bcache.”…”�”}”(hhÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhŒdefinition_list”“”)�”}”(hhh]”(hŒdefinition_list_item”“”)�”}”(hŒBThe bcache wiki can be found at: https://bcache.evilpiepirate.org ”h]”(hŒterm”“”)�”}”(hŒ The bcache wiki can be found at:”h]”hŒ The bcache wiki can be found at:”…”�”}”(hhèh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hæh³hÊh´K hhâubhŒ definition”“”)�”}”(hhh]”hÌ)�”}”(hŒ https://bcache.evilpiepirate.org”h]”hŒ reference”“”)�”}”(hhýh]”hŒ https://bcache.evilpiepirate.org”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”hýuh1hÿhhûubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hhøubah}”(h]”h ]”h"]”h$]”h&]”uh1höhhâubeh}”(h]”h ]”h"]”h$]”h&]”uh1hàh³hÊh´K hhÝubhá)�”}”(hŒuThis is the git repository of bcache-tools: https://git.kernel.org/pub/scm/linux/kernel/git/colyli/bcache-tools.git/ ”h]”(hç)�”}”(hŒ+This is the git repository of bcache-tools:”h]”hŒ+This is the git repository of bcache-tools:”…”�”}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hæh³hÊh´K hj!ubh÷)�”}”(hhh]”hÌ)�”}”(hŒHhttps://git.kernel.org/pub/scm/linux/kernel/git/colyli/bcache-tools.git/”h]”j)�”}”(hj8h]”hŒHhttps://git.kernel.org/pub/scm/linux/kernel/git/colyli/bcache-tools.git/”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j8uh1hÿhj6ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hj3ubah}”(h]”h ]”h"]”h$]”h&]”uh1höhj!ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hàh³hÊh´K hhÝh²hubhá)�”}”(hŒ‹The latest bcache kernel code can be found from mainline Linux kernel: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ ”h]”(hç)�”}”(hŒFThe latest bcache kernel code can be found from mainline Linux kernel:”h]”hŒFThe latest bcache kernel code can be found from mainline Linux kernel:”…”�”}”(hj^h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hæh³hÊh´KhjZubh÷)�”}”(hhh]”hÌ)�”}”(hŒChttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/”h]”j)�”}”(hjqh]”hŒChttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/”…”�”}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jquh1hÿhjoubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khjlubah}”(h]”h ]”h"]”h$]”h&]”uh1höhjZubeh}”(h]”h ]”h"]”h$]”h&]”uh1hàh³hÊh´KhhÝh²hubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÛhh·h²hh³hÊh´NubhÌ)�”}”(hXIt's designed around the performance characteristics of SSDs - it only allocates in erase block sized buckets, and it uses a hybrid btree/log to track cached extents (which can be anywhere from a single sector to the bucket size). It's designed to avoid random writes at all costs.”h]”hXIt’s designed around the performance characteristics of SSDs - it only allocates in erase block sized buckets, and it uses a hybrid btree/log to track cached extents (which can be anywhere from a single sector to the bucket size). It’s designed to avoid random writes at all costs.”…”�”}”(hj™h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)�”}”(hXiBoth writethrough and writeback caching are supported. Writeback defaults to off, but can be switched on and off arbitrarily at runtime. Bcache goes to great lengths to protect your data - it reliably handles unclean shutdown. (It doesn't even have a notion of a clean shutdown; bcache simply doesn't return writes as completed until they're on stable storage).”h]”hXoBoth writethrough and writeback caching are supported. Writeback defaults to off, but can be switched on and off arbitrarily at runtime. Bcache goes to great lengths to protect your data - it reliably handles unclean shutdown. (It doesn’t even have a notion of a clean shutdown; bcache simply doesn’t return writes as completed until they’re on stable storage).”…”�”}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)�”}”(hŒ¹Writeback caching can use most of the cache for buffering writes - writing dirty data to the backing device is always done sequentially, scanning from the start to the end of the index.”h]”hŒ¹Writeback caching can use most of the cache for buffering writes - writing dirty data to the backing device is always done sequentially, scanning from the start to the end of the index.”…”�”}”(hjµh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)�”}”(hXžSince random IO is what SSDs excel at, there generally won't be much benefit to caching large sequential IO. Bcache detects sequential IO and skips it; it also keeps a rolling average of the IO sizes per task, and as long as the average is above the cutoff it will skip all IO from that task - instead of caching the first 512k after every seek. Backups and large file copies should thus entirely bypass the cache.”h]”hX Since random IO is what SSDs excel at, there generally won’t be much benefit to caching large sequential IO. Bcache detects sequential IO and skips it; it also keeps a rolling average of the IO sizes per task, and as long as the average is above the cutoff it will skip all IO from that task - instead of caching the first 512k after every seek. Backups and large file copies should thus entirely bypass the cache.”…”�”}”(hjÃh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hh·h²hubhÌ)�”}”(hXFIn the event of a data IO error on the flash it will try to recover by reading from disk or invalidating cache entries. For unrecoverable errors (meta data or dirty data), caching is automatically disabled; if dirty data was present in the cache it first disables writeback caching and waits for all dirty data to be flushed.”h]”hXFIn the event of a data IO error on the flash it will try to recover by reading from disk or invalidating cache entries. For unrecoverable errors (meta data or dirty data), caching is automatically disabled; if dirty data was present in the cache it first disables writeback caching and waits for all dirty data to be flushed.”…”�”}”(hjÑh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K'hh·h²hubhÌ)�”}”(hŒ’Getting started: You'll need bcache util from the bcache-tools repository. Both the cache device and backing device must be formatted before use::”h]”hŒ“Getting started: You’ll need bcache util from the bcache-tools repository. Both the cache device and backing device must be formatted before use:”…”�”}”(hjßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K-hh·h²hubhŒ literal_block”“”)�”}”(hŒ/bcache make -B /dev/sdb bcache make -C /dev/sdc”h]”hŒ/bcache make -B /dev/sdb bcache make -C /dev/sdc”…”�”}”hjïsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1jíh³hÊh´K1hh·h²hubhÌ)�”}”(hŒµ`bcache make` has the ability to format multiple devices at the same time - if you format your backing devices and cache device at the same time, you won't have to manually attach::”h]”(hŒtitle_reference”“”)�”}”(hŒ `bcache make`”h]”hŒ bcache make”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÿubhŒ© has the ability to format multiple devices at the same time - if you format your backing devices and cache device at the same time, you won’t have to manually attach:”…”�”}”(hjÿh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K4hh·h²hubjî)�”}”(hŒ,bcache make -B /dev/sda /dev/sdb -C /dev/sdc”h]”hŒ,bcache make -B /dev/sda /dev/sdb -C /dev/sdc”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jýjþuh1jíh³hÊh´K8hh·h²hubhÌ)�”}”(hŒÊIf your bcache-tools is not updated to latest version and does not have the unified `bcache` utility, you may use the legacy `make-bcache` utility to format bcache device with same -B and -C parameters.”h]”(hŒTIf your bcache-tools is not updated to latest version and does not have the unified ”…”�”}”(hj+h²hh³Nh´Nubj)�”}”(hŒ`bcache`”h]”hŒbcache”…”�”}”(hj3h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj+ubhŒ! utility, you may use the legacy ”…”�”}”(hj+h²hh³Nh´Nubj)�”}”(hŒ `make-bcache`”h]”hŒ make-bcache”…”�”}”(hjEh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj+ubhŒ@ utility to format bcache device with same -B and -C parameters.”…”�”}”(hj+h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K:hh·h²hubhÌ)�”}”(hŒ—bcache-tools now ships udev rules, and bcache devices are known to the kernel immediately. Without udev, you can manually register devices like this::”h]”hŒ–bcache-tools now ships udev rules, and bcache devices are known to the kernel immediately. Without udev, you can manually register devices like this:”…”�”}”(hj]h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K>hh·h²hubjî)�”}”(hŒOecho /dev/sdb > /sys/fs/bcache/register echo /dev/sdc > /sys/fs/bcache/register”h]”hŒOecho /dev/sdb > /sys/fs/bcache/register echo /dev/sdc > /sys/fs/bcache/register”…”�”}”hjksbah}”(h]”h ]”h"]”h$]”h&]”jýjþuh1jíh³hÊh´KAhh·h²hubhÌ)�”}”(hXÁRegistering the backing device makes the bcache device show up in /dev; you can now format it and use it as normal. But the first time using a new bcache device, it'll be running in passthrough mode until you attach it to a cache. If you are thinking about using bcache later, it is recommended to setup all your slow devices as bcache backing devices without a cache, and you can choose to add a caching device later. See 'ATTACHING' section below.”h]”hXÇRegistering the backing device makes the bcache device show up in /dev; you can now format it and use it as normal. But the first time using a new bcache device, it’ll be running in passthrough mode until you attach it to a cache. If you are thinking about using bcache later, it is recommended to setup all your slow devices as bcache backing devices without a cache, and you can choose to add a caching device later. See ‘ATTACHING’ section below.”…”�”}”(hjyh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KDhh·h²hubhÌ)�”}”(hŒThe devices show up as::”h]”hŒThe devices show up as:”…”�”}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KLhh·h²hubjî)�”}”(hŒ/dev/bcache”h]”hŒ/dev/bcache”…”�”}”hj•sbah}”(h]”h ]”h"]”h$]”h&]”jýjþuh1jíh³hÊh´KNhh·h²hubhÌ)�”}”(hŒAs well as (with udev)::”h]”hŒAs well as (with udev):”…”�”}”(hj£h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KPhh·h²hubjî)�”}”(hŒ7/dev/bcache/by-uuid/ /dev/bcache/by-label/