Should I switch to BTRFS or ZFS on Linux Desktop?

This is a recap of weird things that could happen with the newer Linux Filesystems. Ubuntu 16.04 and Debian Linux ship both ZFS (OpenZFS) and BTRFS so it's normal to think about it, but like many "new" Linux technologies (e.g Wayland), none agree when it's the right moment to jump on them.

btrfs-transacti WTF is doing btrfs? btrfs-transacti and then btrfs-cleanup

Do I need BTRFS or ZFS?

TLDR; NO. EXT4 is the fastest and more mature filesystem, but if you care about features like:

..then, probably YES

Unfortunatly, the next-gen filesystems are really quite diffent compared to the current ones, many features that you could be used to, could work differently or not be supported.

Stability

If you google for "BTRFS vs ZFS" you find tons of comments, on Reddit, on Hacker News,.. but everybody seem to agree that ZFS is more stable than BTRFS.
Personally I had problems with both, but no data loss, but the most severe issue I got was with ZFS. A kernel panic in some situations. So don't trust the internet, test it yourself and check the bugs.

How often do you edit that big file?

I'm just asking because normally you don't care how much you change a file, but with these COW filesystems big files that change often should be managed differently and it's better to switch off the Copy-On-Write feature on DBs, Torrent files and VMs.

On BTRFS:

chattr +C big_file  
chattr -R +C directory/  

Maintainance

Another consideration is about maintainance, on EXT4 Linux I never planned it. After a number of reboots Ubuntu run fsck but I never had to do it manually.
With BTRFS You have to schedule it, and some tasks slow down you fs performance.

On BTRFS: scrub, trim, defrag, trim, balance. Look at btrfsmaintainance on Github

I heard you like a swapfile..

If you try to mount a file as swapfile on ext4 to extend your RAM it's OK, but on btrfs it isn't supported.
Or at least not as in ext4.

Another script on Github: btrfs-swapon

How much free space do I have?

Again, when you remove a file on a COW fs, it couldn't be removed really because an old snapshot could reference to it.

df -h /  

nope

Conclusion: how to backup with COW filesystem?

It really depends on scenario, in brief you have at least 3 strategies:

  • (Desktop with EXT4/NTFS) <=> ssh+rsync <=> (Backup Server with BTRFS/ZFS snapshots)
  • (Desktop with EXT4/NTFS) <=> syncthing <=> (Backup Server with BTRFS/ZFS snapshots)
  • (Desktop with BTRFS/ZFS snapshots) <=> snapshots/volume replication <=> ( Backup server with BTRFS/ZFS snapshots)(*)

(*) this options require a root user accesible remotely on the backup server

Some interesting links on the topic

--

corso javascript