LWN: Comments on "Bringing bcachefs to the mainline" https://lwn.net/Articles/895266/ This is a special feed containing comments posted to the individual LWN article titled "Bringing bcachefs to the mainline". en-us Thu, 09 Oct 2025 03:08:22 +0000 Thu, 09 Oct 2025 03:08:22 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Bringing bcachefs to the mainline https://lwn.net/Articles/952013/ https://lwn.net/Articles/952013/ kreijack <div class="FormattedComment"> <span class="QuotedText">&gt; &gt; Overstreet said that bcachefs has the same basic problem that Btrfs does with regard to inode numbers, subvolumes, and NFS</span><br> <p> <span class="QuotedText">&gt; It not just NFS. I couldn't wait for bcachefs to hit mainline. But now I've realized, that an _unprivileged_ user can do this: </span><br> <p> Both BTRFS and BCacheFS (but also a basic LVM/dm snapshot) shared the same problem of having snapshots with (necessarily) file having the same inode number.<br> <p> However BTRFS create for each subvolume a different fsid (see statfs(2), f_fsid).<br> <p> [code]<br> ghigo@venice:/var/btrfs/@test-subvol$ btrfs sub cre vol1<br> Create subvolume './vol1'<br> ghigo@venice:/var/btrfs/@test-subvol$ mkdir vol1/dir1<br> ghigo@venice:/var/btrfs/@test-subvol$ btrfs sub snap vol1 vol1/snp1<br> Create a snapshot of 'vol1' in 'vol1/snp1'<br> ghigo@venice:/var/btrfs/@test-subvol$ ls -li vol1/<br> total 0<br> 257 drwxr-xr-x 1 ghigo ghigo 0 2023-11-20 18:59 dir1<br> 256 drwxr-xr-x 1 ghigo ghigo 8 2023-11-20 18:59 snp1<br> ghigo@venice:/var/btrfs/@test-subvol$ find .<br> .<br> ./vol1<br> ./vol1/dir1<br> ./vol1/snp1<br> ./vol1/snp1/dir1<br> <p> <p> higo@venice:/var/btrfs/@test-subvol$ stat -f vol1/.<br> File: "vol1/."<br> ID: 727f02496c886f2e Namelen: 255 Type: btrfs<br> Block size: 4096 Fundamental block size: 4096<br> Blocks: Total: 26214400 Free: 4149320 Available: 3830236<br> Inodes: Total: 0 Free: 0<br> ghigo@venice:/var/btrfs/@test-subvol$ stat -f vol1/dir1/<br> File: "vol1/dir1/"<br> ID: 727f02496c886f2e Namelen: 255 Type: btrfs<br> Block size: 4096 Fundamental block size: 4096<br> Blocks: Total: 26214400 Free: 4149320 Available: 3830236<br> Inodes: Total: 0 Free: 0<br> ghigo@venice:/var/btrfs/@test-subvol$ stat -f vol1/snp1/dir1/<br> File: "vol1/snp1/dir1/"<br> ID: 727f02496c886f21 Namelen: 255 Type: btrfs<br> Block size: 4096 Fundamental block size: 4096<br> Blocks: Total: 26214400 Free: 4149320 Available: 3830236<br> Inodes: Total: 0 Free: 0<br> <p> [/code]<br> </div> Mon, 20 Nov 2023 18:15:32 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/951935/ https://lwn.net/Articles/951935/ donald.buczek &gt; Overstreet said that bcachefs has the same basic problem that Btrfs does with regard to inode numbers, subvolumes, and NFS <p> It not just NFS. I couldn't wait for bcachefs to hit mainline. But now I've realized, that an _unprivileged_ user can do this: <pre> buczek@dose:/scratch/local3$ bcachefs subvolume create vol1 buczek@dose:/scratch/local3$ mkdir vol1/dir1 buczek@dose:/scratch/local3$ bcachefs subvolume snapshot vol1/snp1 buczek@dose:/scratch/local3$ ls -li vol1/ total 0 1342189197 drwxrwxr-x 2 buczek buczek 0 Nov 20 15:01 dir1 1476413180 drwxrwxr-x 3 buczek buczek 0 Nov 20 15:01 snp1 buczek@dose:/scratch/local3$ ls -li vol1/snp1/ total 0 1342189197 drwxrwxr-x 2 buczek buczek 0 Nov 20 15:01 dir1 buczek@dose:/scratch/local3$ find . . ./vol1 find: File system loop detected; ‘./vol1/snp1’ is part of the same file system loop as ‘./vol1’. ./vol1/dir1 buczek@dose:/scratch/local3$ ls -lR .: total 0 drwxrwxr-x 3 buczek buczek 0 Nov 20 15:03 vol1 ./vol1: total 0 drwxrwxr-x 2 buczek buczek 0 Nov 20 15:01 dir1 drwxrwxr-x 3 buczek buczek 0 Nov 20 15:01 snp1 ./vol1/dir1: total 0 ls: ./vol1/snp1: not listing already-listed directory buczek@dose:/scratch/local3$ </pre> Multiple files with the same inode number on the same filesystem would break too many tools, for example backup. Mon, 20 Nov 2023 14:34:59 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/899222/ https://lwn.net/Articles/899222/ kena <div class="FormattedComment"> I&#x27;ll admit, I don&#x27;t come to LWN for humor, but this made me literally laugh out loud. I mean, &quot;fsck -y /dev/foo&quot; -- what could possibly go wrong?<br> </div> Tue, 28 Jun 2022 13:12:40 +0000 bcachefs needs scrub https://lwn.net/Articles/896533/ https://lwn.net/Articles/896533/ LinAdmin <div class="FormattedComment"> It looks like the creator of bcachefs does not care to implement scrubbing. <br> I got no answer when offering to help testing when this important feature is ready.<br> </div> Sat, 28 May 2022 13:39:37 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896156/ https://lwn.net/Articles/896156/ zblaxell <div class="FormattedComment"> It doesn&#x27;t. For RAID1* mirroring btrfs simply reads each copy until the csum matches. For parity RAID[56], it assumes the blocks that have bad csums are bad, and reconstructs them in the normal parity raid way by reading the other blocks from the stripe and recomputing the bad blocks. If that doesn&#x27;t provide a block with the right csum, or there are additional csum errors when reading other data blocks, then the block is gone and read returns EIO.<br> <p> Strictly speaking, the csum is on the extent, not the file, which only matters when things like snapshots and dedupe make lots of files reference the same physical disk blocks, or compression transforms the data before storing it on disk. There&#x27;s a single authoritative csum that covers all replicas of that block, whether they are verbatim copies or computed from other blocks. That csum is itself stored in a tree with csums on the pages.<br> <p> There are no csums on the parity blocks, so btrfs&#x27;s on-disk format cannot correctly identify the corrupted disk in RAID[56] if the parity block is corrupted and some of the data blocks in the stripe have no csums (either free space or nodatasum files). It&#x27;s possible to determine that parity doesn&#x27;t match the data and the populated data blocks are correct, but not whether the corrupted device is the one holding the parity block or one of the devices holding the unpopulated data blocks.<br> <p> There&#x27;s some fairly significant missing pieces in the btrfs RAID[56] implementation: scrub neither detects faults in nor corrects parity blocks, and neither do RMW stripe updates (which are sort of a bug in and of themselves), and half a dozen other bugs that pop up in degraded mode.<br> </div> Tue, 24 May 2022 21:18:07 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896155/ https://lwn.net/Articles/896155/ Wol <div class="FormattedComment"> Yup, if it keeps a check-sum per DISK block, fine. But if the check-sum is *file*-based, how does it know which *disk* is corrupt?<br> <p> Cheers,<br> Wol<br> </div> Tue, 24 May 2022 20:28:44 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896148/ https://lwn.net/Articles/896148/ atnot <div class="FormattedComment"> <font class="QuotedText">&gt; Although at some point, the network storage devices, whether they are sharing out a block or blob service, need to run on something and manage the storage, and who is writing that code?</font><br> <p> Afaict, there&#x27;s two reasons storage folks generally skip the kernel. The first is that the UNIX filesystem API semantics are a poor fit for what they are doing, the second is that the code isn&#x27;t capable of running in a distributed manner.<br> <p> So for blob storage it&#x27;s generally going to be almost entirely in user space, with no disk-level redundancy at all. See e.g. Ceph, Minio, Backblaze.<br> <p> EMC/netapp/vSAN all have, to my knowledge, their own proprietary disk layouts. VMWare has their own kernel, not sure about the others. The block devices they present are all also redundant across multiple machines, so dm-raid alone wouldn&#x27;t quite cut it there. You can use Ceph for block storage too, but that also skips the kernel.<br> <p> So in general, this is why I say I find it hard to see a place for filesystem-level parity RAID in the near future. It basically amounts to a layering violation in today&#x27;s virtualized infrastructure. But who knows, things might change again.<br> </div> Tue, 24 May 2022 20:05:05 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896147/ https://lwn.net/Articles/896147/ xanni <div class="FormattedComment"> Many years ago I worked for an ISP that had a hardware RAID controller fail with a firmware bug that caused it to write bad data to all copies on all redundant storage devices... in both data centres in Adelaide and Sydney. We had an engineer from the vendor in the US on a flight to Australia the same day, and had to spend several days restoring all our customers&#x27; data from tapes.<br> </div> Tue, 24 May 2022 19:05:03 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896146/ https://lwn.net/Articles/896146/ raven667 <div class="FormattedComment"> Although at some point, the network storage devices, whether they are sharing out a block or blob service, need to run on something and manage the storage, and who is writing that code? Even on a hardware raid controller, is the actual raid card itself just an embedded linux system? It&#x27;s turtles all the way down, do all the vendors of this kind of hardware write their own proprietary in-house raid and filesystems or do some use the built-in linux support and innovate in the higher layer management, by actually using those building blocks to their fullest potential?<br> </div> Tue, 24 May 2022 18:53:17 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896138/ https://lwn.net/Articles/896138/ xanni <div class="FormattedComment"> I haven&#x27;t looked at the BTRFS implementation to confirm, but I believe it simply keeps a checksum for each file block, so it&#x27;s easy to tell which disk blocks are valid: any combination of two RAID5 or RAID6 blocks that don&#x27;t recover a block with the correct checksum include a corrupted disk block, in which case try one of the other combinations. If none are valid, you have more corrupt disk blocks than your redundancy level.<br> </div> Tue, 24 May 2022 16:15:05 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896133/ https://lwn.net/Articles/896133/ xanni <div class="FormattedComment"> RAID5 allows you to recover the data with any 2 of the 3 blocks for each block of the file. RAID6 allows you to use any 2 of the 4 blocks and is designed to address the issue of a second failure during the recovery from a single failure, since recovery from a full drive failure can take quite a while. If you lose an entire drive with block-level RAID5, you can replace it and recover all data online with zero downtime. If you regularly scrub any level of btrfs RAID, you can repair corrupted blocks with zero downtime.<br> </div> Tue, 24 May 2022 16:02:54 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896127/ https://lwn.net/Articles/896127/ Wol <div class="FormattedComment"> How does that work then? If you&#x27;ve got raid-5, and the checksum reports &quot;this file is corrupt&quot;, how do you recover the original file? If all you&#x27;ve got is raid-5 then it&#x27;s mathematically impossible.<br> <p> If you&#x27;ve got raid-1, the checksum identifies which copy is corrupt and therefore which copy is correct. If you&#x27;ve got raid-6, then you can solve the equations to get your data back. But raid-5? Sorry, unless that checksum tells you which disk block is corrupt, you&#x27;re stuffed.<br> <p> Cheers,<br> Wol<br> </div> Tue, 24 May 2022 15:22:40 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896082/ https://lwn.net/Articles/896082/ xanni <div class="FormattedComment"> <font class="QuotedText">&gt; Just a shame that second bit of info doesn&#x27;t let you recover the file ...</font><br> <p> But it does. If you have any level of BTRFS redundancy, you can run &quot;btrfs scrub&quot; to replace any data whose checksum doesn&#x27;t match with one of the other copies where it does match. I like to run it monthly. That&#x27;s one of the big advantages of BTRFS.<br> </div> Tue, 24 May 2022 12:49:00 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896075/ https://lwn.net/Articles/896075/ Wol <div class="FormattedComment"> <font class="QuotedText">&gt; Filesystem based RAID is just … better than block based. Even btrfs raid5/6 should be less prone to data corruption than any of the block based solutions, simply because it has the ability to actually tell which possible version of the data is correct. With block based raid (5 esp) if you get some silent data corruption the raid controller/OS will just pick an option essentially at random, so it only helps you if the drive either tells you the read went bad or an entire drive fails.</font><br> <p> Which is why I run dm-integrity underneath my raid.<br> <p> That is the WHOLE POINT of raid - it&#x27;s primarily to protect against disk failure. Raid 5 contains ONE additional data point, allowing you to recover from ONE unknown, eg &quot;the disk failed, what were the contents?&quot;. It&#x27;s useless if you have TWO unknowns - &quot;oh shit! One of my disks is corrupt - which disk and what were the original contents?&quot; That&#x27;s why you need raid 6 - you have TWO additional data points allowing you to recover from those said two unknowns. The problem, of course, is if your data is corrupt it&#x27;s expensive to check on every access ... <br> <p> And which is why I run dm-integrity - that catches the &quot;which disk is corrupt?&quot;, leaving my raid-5 to deal with &quot;and what were the original contents?&quot; I&#x27;ve decided that, on a personal level, the time hit from the integrity check is okay.<br> <p> (Oh, and just like ordinary raid, btrfs will be no help whatsoever if your disk is corrupt - it&#x27;ll just tell you you&#x27;ve lost your file - which admittedly is a bit more than md-raid-5, but then btrfs stores that second bit of info, a file checksum. Just a shame that second bit of info doesn&#x27;t let you recover the file ...)<br> <p> Cheers,<br> Wol<br> </div> Tue, 24 May 2022 11:22:33 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896066/ https://lwn.net/Articles/896066/ atnot <div class="FormattedComment"> <font class="QuotedText">&gt; Also, btrfs&#x27; RAID-[56] has spent 10+ years getting to production quality, and still is at “should not be used in production, only for evaluation or testing”</font><br> <p> I don&#x27;t think this is accurate. My perception is that the RAID56 implementation has been more or less abandoned in it&#x27;s current unfinished state. This is not that surprising to me because in general, OS-level parity RAID is kind of dead, at least amongst the people who could afford to put significant money behind developing it.<br> <p> In a modern datacenter you&#x27;re basically just going to have three types of storage: Local scratchpad SSDs, network block devices and blob storage services. The first is usually RAID10 for performance, the second solves redundancy at a lower level and the third solves redundancy at a higher level. This puts RAID56 in an awkward spot where it&#x27;s useful for many home users, still decently well supported, but nobody else is really there to care about it anymore.<br> </div> Tue, 24 May 2022 07:46:51 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896059/ https://lwn.net/Articles/896059/ Sesse <div class="FormattedComment"> If you have RAID-6, and a spurious bit flip (which generally needs to happen before it&#x27;s written to disk, as ECC protects you well afterwards), you can tell which disk is bad.<br> <p> Also, btrfs&#x27; RAID-[56] has spent 10+ years getting to production quality, and still is at “should not be used in production, only for evaluation or testing” (<a href="https://btrfs.readthedocs.io/en/latest/btrfs-man5.html#raid56-status-and-recommended-practices">https://btrfs.readthedocs.io/en/latest/btrfs-man5.html#ra...</a>, linked from the btrfs wiki at kernel.org), so if nothing else, it&#x27;s amazingly hard to get right.<br> </div> Mon, 23 May 2022 22:09:49 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/896054/ https://lwn.net/Articles/896054/ bartoc <div class="FormattedComment"> Filesystem based RAID is just … better than block based. Even btrfs raid5/6 should be less prone to data corruption than any of the block based solutions, simply because it has the ability to actually tell which possible version of the data is correct. With block based raid (5 esp) if you get some silent data corruption the raid controller/OS will just pick an option essentially at random, so it only helps you if the drive either tells you the read went bad or an entire drive fails. <br> <p> Block based RAID can be useful if you have real raid controllers and a big storage array though, as that will reduce bandwidth usage. <br> <p> bcachefs’s approach to raid sounds extremely appealing, and its not something block based raid can really do. <br> </div> Mon, 23 May 2022 21:25:12 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/895694/ https://lwn.net/Articles/895694/ zblaxell <div class="FormattedComment"> ext4 is quantitatively less robust than ext3 in this scenario because ext4&#x27;s metadata is more efficient, so you lose more metadata per byte of dropped write.<br> <p> fsck can only delete stuff until you can mount the filesystem read-write again. Lose a few of the wrong blocks on ext4, and the big and interesting files that aren&#x27;t already in your backups end up mostly deleted.<br> <p> Writeback caches can get pretty big these days. Losing a few sectors can destroy the most interesting data, but losing a few hundred million sectors and you might as well go directly to mkfs + restore backups because it will take less time than verifying everything by hand, or even using rsync with -c and --del options from your backups.<br> <p> It&#x27;s possible to set up multi-device arrays with writeback caches, but you have to be very careful to avoid having faults in the cache impact multiple fault isolation domains in the backing storage. The simplest form of this is to build multi-drive arrays out of pairs of SSD and HDD, and treat a SSD failure as if the paired HDD failed at the same time. Another way to do it is to have redundant cache SSDs so that faults in the cache are isolated from the backing storage, but some faults (e.g. undetected SSD corruption) can&#x27;t be easily isolated this way.<br> </div> Wed, 18 May 2022 19:35:31 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/895678/ https://lwn.net/Articles/895678/ developer122 <div class="FormattedComment"> fsck is nice when it works, but I think everyone has stockholm syndrome from over 45 years of using it.<br> </div> Wed, 18 May 2022 16:18:09 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/895675/ https://lwn.net/Articles/895675/ xanni <div class="FormattedComment"> If the cache device fails, you can still fsck and mount the underlying device without the cache. You will only have lost whatever was pending writeback. Depending on the underlying filesystem, that may or may not be a major issue. ext4 is pretty robust.<br> </div> Wed, 18 May 2022 15:32:30 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/895671/ https://lwn.net/Articles/895671/ cmurf <div class="FormattedComment"> There&#x27;s a reason why writethrough is the default. It&#x27;s safe. Write back is only as safe as the reliability of the cache device. If it fails while using write back mode, you lose the entire fs. And that&#x27;s because it&#x27;s likely critical metadata writes only make it to the cache device, not the backing device. I think the reality is, if your workload requires significant random write performance, you need to pay for for big enough SSDs to accommodate the workload, rather than expecting you can get SSD random write performance all the way to the backing device. Where this really bites people, is when they use a single cache device for multiple backing devices, e.g. in a RAID configuration. Lose the cache device while in write back mode, and the entire array is toast.<br> </div> Wed, 18 May 2022 15:26:29 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/895672/ https://lwn.net/Articles/895672/ developer122 <div class="FormattedComment"> It sounds like it would be better solve those warts before upstreaming, rather than further cement them.<br> </div> Wed, 18 May 2022 15:20:59 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/895620/ https://lwn.net/Articles/895620/ xanni <div class="FormattedComment"> This discussion may help: <a href="https://bbs.archlinux.org/viewtopic.php?id=250525">https://bbs.archlinux.org/viewtopic.php?id=250525</a><br> </div> Wed, 18 May 2022 12:39:48 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/895619/ https://lwn.net/Articles/895619/ Sesse <div class="FormattedComment"> Well, 130 kB random reads all over the file? Should be well below the 4MB default limit.<br> </div> Wed, 18 May 2022 12:20:21 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/895618/ https://lwn.net/Articles/895618/ xanni <div class="FormattedComment"> More specifically, take a look at <a href="https://www.kernel.org/doc/html/latest/admin-guide/bcache.html#troubleshooting-performance">https://www.kernel.org/doc/html/latest/admin-guide/bcache...</a> and consider decreasing /sys/block/bcache0/bcache/sequential_cutoff to see if that helps.<br> </div> Wed, 18 May 2022 12:06:05 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/895616/ https://lwn.net/Articles/895616/ xanni <div class="FormattedComment"> Note that the default settings for bcache are to only cache random reads and writes, and pass sequential reads and writes through without caching. You may want to adjust those default settings for your use case!<br> </div> Wed, 18 May 2022 11:59:04 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/895615/ https://lwn.net/Articles/895615/ Sesse <div class="FormattedComment"> As a data point on the opposite side, I&#x27;ve tried using bcache with a 240GB SSD against a 2x3TB disk array to accelerate a seek-heavy video load, and it&#x27;s been completely useless. The SSD is hardly ever used, even though the actual working set should be in the tens of gigabytes at a any time.<br> <p> While the article is interesting, I&#x27;m not entirely sure why I should be excited for bcachefs; how does it fare in benchmarks, for one? (I don&#x27;t like to mix up my RAID/LVM and my filesystems in general, so I don&#x27;t care about the ZFS/btrfs-like features.)<br> </div> Wed, 18 May 2022 11:41:46 +0000 bcachefs and scrub https://lwn.net/Articles/895612/ https://lwn.net/Articles/895612/ fratti <div class="FormattedComment"> In [1], it&#x27;s described that bcachefs does not yet do scrubbing. Is this document outdated and it&#x27;s already implemented, or is this feature on the horizon? If the latter, will it arrive before mainline inclusion or after? I may be misunderstanding the importance of data scrubbing in the context of long-term data safety though, so if this isn&#x27;t critical in ensuring an array keeps functioning for a decade or more without data loss, feel free to correct me.<br> <p> I&#x27;m excited about the possibilities bcachefs opens, but not quite adventurous enough to try and use an out-of-tree filesystem. The idea of just giving the system a bunch of block devices and saying &quot;here&#x27;s how durable I consider them, here&#x27;s how many replicas I want&quot; and having it figure it out on its own seems very appealing, as well as being able to set replication and compression on a per-file granularity.<br> <p> [1]: <a href="https://bcachefs.org/bcachefs-principles-of-operation.pdf">https://bcachefs.org/bcachefs-principles-of-operation.pdf</a><br> </div> Wed, 18 May 2022 10:10:51 +0000 Bringing bcachefs to the mainline https://lwn.net/Articles/895601/ https://lwn.net/Articles/895601/ xanni <div class="FormattedComment"> I&#x27;m very excited by bcachefs and while waiting for it decided to start using bcache. I&#x27;ve been using it to back a (large, cheap) shingled magnetic recording hard drive with an SSD cache for my Steam games library, to improve performance especially for the larger games (Horizon Zero Dawn is nearly 80GB.) It&#x27;s been working great so far.<br> </div> Wed, 18 May 2022 07:38:12 +0000