The case for BCacheFS inclusion in PVE

alexskysilk

Distinguished Member
Oct 16, 2015
3,049
1,235
243
Chatsworth, CA
www.skysilk.com
PVE has (and continues to have) a large presence in the homelab/self hosting crowd. The Primary filesystem option employed for single host applications was and is ZFS, due to its robust featureset and code maturity. Yet ZFS's core structural geometry—fixed virtual device (vdev) layouts, rigid pool topologies, and bolt-on workarounds like RAIDZ expansion or special vdevs—shows strain when modern single-node servers mix NVMe, SATA SSDs, and high-capacity hard drives. Btrfs aimed for a Linux-native copy-on-write alternative with features like in-place defragmentation and out-of-band deduplication, and supports more RAID levels than striped mirrors alone, but its multi-device parity modes have long carried reliability caveats that keep serious storage users away from RAID5/6 on critical data.

Bcachefs offers a fundamentally different single-node model. Using B-tree allocation, per-path replication or erasure coding (EC), multi-tier caching and promotion/demotion, and flexible disk pooling, it lets a single namespace adapt to mixed drive capacities and speeds without forcing rigid vdev boundaries. Consider a single PVE host with two NVMe drives, two SATA SSDs, and eight hard drives. With ZFS today, you typically split storage across distinct pools or vdevs—such as mirrored NVMe or SSDs for virtual disks and RAIDZ2 on the hard drives for bulk data- and you must accept fixed vdev sizing rules. With bcachefs, you can keep a unified namespace where virtual machine subvolumes use replication with fast NVMe/SSD tiering while bulk media or backup subvolumes use erasure coding backed by HDDs and flash caching, all within one storage pool.

BCacheFS design criteria seems to be purpose made for single node PVE. Its actually more flexible and capable then ceph as long as the failiure domain remains lower then host- BUT it is not yet a turnkey, zero-quirk replacement for ZFS on live virtual disks. Out-of-tree kernel status (following its removal from mainline Linux in 6.18), background tiering and erasure-coding overhead under heavy VM I/O, and snapshot, subvolume, and discard/TRIM edge cases still require thorough validation. Still, out-of-tree status did not stop ZFS from becoming standard on PVE; Proxmox's own willingness to integrate and test ZFS helped mature it into a reliable hypervisor option. Adopting bcachefs as a supported PVE storage backend—starting as an experimental target and hardening it against real hypervisor workloads—is the clearest path to turning its architectural promise into peak single-node storage.
 
  • Like
Reactions: Gavino
My biggest issue with CoW filesystems is in relation to dirty bitmaps. QEMU keeps its persistent dirty bitmap in the qcow2 v3 disk image file. You shouldn't run qcow2 on a CoW FS like ZFS because of write amplification from CoW on CoW. So for my ZFS-based VMs I use are "raw" format, and the dirty bitmap for that is not persistent - every reboot I have to do another full backup of the VM (which sucks). So I only use ZFS for "small" (sub 100GB) VMs, and anything bigger I put on a ext4 RAID array and use qcow2 so that the dirty bitmap persists between reboots.

BTRFS and BcacheFS have "nocow" modes which would probably allow one to run qcow2 disk images, but then I think you give up checksums, scrubs and in-line compression. I don't know how well tested those modes are. BcacheFS is the better of the two for its much better multi-disk support.

I don't know what's technically possible, but would love for QEMU devs to work with Kent Overstreet to have a "raw" disk format for BcacheFS, but where the dirty bitmap has support at the filesystem level so that it survives reboots, and with checksumming and compression all supported by the FS. That would be an absolute game-changer.
 
My biggest issue with CoW filesystems is in relation to dirty bitmaps. QEMU keeps its persistent dirty bitmap in the qcow2 v3 disk image file. You shouldn't run qcow2 on a CoW FS like ZFS because of write amplification from CoW on CoW.
I dont think anyone wants to do this on any filesystem. FWIW I dont think neither PVE nor PBS use the persistent dirty bitmap feature for anything.

every reboot I have to do another full backup of the VM (which sucks).
Complain to the devs. I imagine their thinking is something to the effect of a guest interruption is a rare event, and full read/delta reconstruct is a fair tradeoff. Better yet- if you're using a CoW filesystem you have a superior mechanism for this anyway- snapshot based differentials. and on that subject- this is actually a place where bcachefs is behind as the snapshot send/receive functionality isnt built yet.
BTRFS and BcacheFS have "nocow" modes
BTRFS does. BCacheFS doesnt.

but then I think you give up checksums, scrubs and in-line compression.
Correct.

I don't know what's technically possible, but would love for QEMU devs to work with Kent Overstreet to have a "raw" disk format for BcacheFS, but where the dirty bitmap has support at the filesystem level so that it survives reboots, and with checksumming and compression all supported by the FS. That would be an absolute game-changer.
I think your evaluation of the "problem" is massively overblown. The workarounds (both PBS and snapshots) mean that this isnt a missing feature- its just the difference between the occasional faster differential copy ON QCOW2 which no one would use if they could help it for the reasons you yourself mentioned- no checksums, scrubs and in-line compression. Its also slower.

@fabian thanks- I think Kent explained the upside better then me :) its been over a year since the last post on that thread, and the filesystem reached stable status. just sayin.