i’ve instaled opensuse tumbleweed a bunch of times in the last few years, but i always used ext4 instead of btrfs because of previous bad experiences with it nearly a decade ago. every time, with no exceptions, the partition would crap itself into an irrecoverable state
this time around i figured that, since so many years had passed since i last tried btrfs, the filesystem would be in a more reliable state, so i decided to try it again on a new opensuse installation. already, right after installation, os-prober failed to setup opensuse’s entry in grub, but maybe that’s on me, since my main system is debian (turns out the problem was due to btrfs snapshots)
anyway, after a little more than a week, the partition turned read-only in the middle of a large compilation and then, after i rebooted, the partition died and was irrecoverable. could be due to some bad block or read failure from the hdd (it is supposedly brand new, but i guess it could be busted), but shit like this never happens to me on extfs, even if the hdd is literally dying. also, i have an ext4 and an ufs partition in the same hdd without any issues.
even if we suppose this is the hardware’s fault and not btrfs’s, should a file system be a little bit more resilient than that? at this rate, i feel like a cosmic ray could set off a btrfs corruption. i hear people claim all the time how mature btrfs is and that it no longer makes sense to create new ext4 partitions, but either i’m extremely unlucky with btrfs or the system is in fucking perpetual beta state and it will never change because it is just good enough for companies who can just, in the case of a partition failure, can just quickly switch the old hdd for a new one and copy the nightly backup over to it
in any case, i am never going to touch btrfs ever again and i’m always going to advise people to choose ext4 instead of btrfs
I mean, unless you really like one of the weird bells and whistles btrfs supports ext4 is just faster and more reliable. If you don’t have weird power user needs then anything else is a downgrade. Even ZFS really only makes a significant difference if you’re moving around gigabytes of data on a daily basis. If you’re on a BSD anyway feel free to go for it, but for most people there is no real benefit. Every other fancy new file system is just worse for typical desktop use cases. People desperately want to replace ext4 because it’s old, but there’s just really nothing to gain from it. Sometimes simple and reliable is good.
You’re right to give up on btrfs. It’s been so long in development and it just isn’t ready. Ext4 or ZFS are mature and excellent file systems. There’s no need for btrfs these days. It always has and always will disappoint.
Everyone singing the praises of it are the sysadmin equivalent of the software engineer yelling ‘it works on my machine’ when a user finds an issue.
deleted by creator
My system has been btrfs since 2017. No issues. Maybe you have random powerloss?
You know, protecting against Powerloss was the major feature of filesystems in a time gone by…
It only works if the hardware doesn’t lie about write barriers. If it says it’s written some sectors, btrfs assumes that reading any of those sectors will return the written data rather than the data that was there before. What’s important here isn’t that the data will forever stay in-tact but ordering. Once a metadata generation has been written to disk, btrfs waits on the write barrier and only updates the superblock (the final metadata “root”) afterwards.
If the system loses power while the metadata generation is being written, all is well because the superblock still points at the old generation as the write barrier hasn’t passed yet. On the next boot, btrfs will simply continue with the previous generation referenced in the superblock which is fully committed.
If the hardware lied about the write barrier before the superblock update though (i.e. for performance reasons) and has only written e.g. half of the sectors containing the metadata generation but did write the superblock, that would be an inconsistent state which btrfs cannot trivially recover from.If that promise is broken, there’s nothing btrfs (or ZFS for that matter) can do. Software cannot reliably protect against this failure mode.
You could mitigate it by waiting some amount of time which would reduce (but not eliminate) the risk of the data before the barrier not being written yet but that would also make every commit take that much longer which would kill performance.It can reliably protect against power loss (bugs not withstanding) but only if the hardware doesn’t lie about some basic guarantees.
Yep, this entry explains about btrfs zfs and powerloss reovery, but that buggy hardware could mess with that system. https://unix.stackexchange.com/questions/340947/does-btrfs-guarantee-data-consistency-on-power-outages#520063
This is just telling me that my loyalty to FAT(32) is valid.
Have you tested your RAM?
not sure what the relation would be. my ram is fine afaik
Run memtest86+. I had similar issues and it was due to faulty RAM.
Typically when there are “can’t mount” issues with btrfs it’s cause the write log got corrupted, and memory errors are usually the cause.
BTRFS needs a clean write log to guarantee the state of the blocks to put the filesystem overlay on top of, so if it’s corrupted btrfs usually chooses to not mount until you do some manual remediations.
If the data verification stuff seems more of a pain in the ass than it’s worth you can turn most of those features off with mount options.
oh wow, that’s crazy. thanks for the info, but it’s a little fucked up that btrfs can make a memory failure cause a filesystem corruption
It’s the other way around: The memory failure causes the corruption.
Btrfs is merely able to detect it while i.e. extfs is not.
Not really. Even TrueNAS Core (ZFS) highly recommends ECC memory to mitigate this possibility from occurring. After reading more about filesystems in general and when money allowed, I took this advice as gospel when upgrading my server from junk I found laying around to a proper Supermicro ATX server mobo.
The difference I think is that BRTFS is more vulnerable to becoming unmountable whereas other filesystems have a better chance of still being mountable but contain missing or corrupted data. The latter usually being preferable.
For desktop use some people don’t recommend ZFS as if the right memory corruption conditions are met, it can eat your data as well. It’s why Linus Torvalds goes on a rant every now and then about how bullshit it is that Intel normalized paywalling ECC memory to servers only.
I disagree and think the benefits of ZFS on a desktop without ECC outweigh a rare possibility that can be mitigated with backups.
Won’t say it… Won’t say it… ZFS!! Oops.
i’ve been meaning to try it, but i installed freebsd to an ufs partition instead of zfs because ufs was marked by default in the installer 🤦
It’s fantastic, IMO. Still use LUKS and software raid for root, but everything else is encrypted raidz.
Get on FreeBSD + ZFS
You can use Linux with zfs if you install open zfs.
you can, but from what i heard, maybe you shouldn’t, bc openzfs is much more unreliable than true zfs
Oh
I realize this is a rant but you coulda included hardware details.
I’m gonna contrast your experience with about 300 or so installs I did in the last couple of years, all on btrfs, 90% fedora, 9% ubuntu and the rest debian and mint and other stragglers, nothing but the cheapest and trashiest SSDs money can buy, the users are predominantly linux illiterate. I also run all my stuff (5 workstations and laptops) exclusively on btrfs and have so for 5+ years. not one of those manifested anything close to what you’re describing.
so I hope the people that get your recommendations also take into consideration your sample size.
I run btrfs on every hard drive that my Linux boxes use and there’s the occasional hiccup but I’ve never run into anything “unrecoverable.”
I will say that compared to extfs, where the files will just eat shit if there’s a write corruption, because btrfs tries to baby the data I think there appear to be more “filesystem” issues.
I’ve had btrfs go into an error state because of a bad write before, but it was pretty easy to recover from
could be due to some bad block or read failure from the hdd (it is supposedly brand new, but i guess it could be busted)
I’d suspect the controller or cable first.
shit like this never happens to me on extfs, even if the hdd is literally dying
You say that as if it’s a good thing. If you HDD is “literally dying”, you want the filesystem to fail safe to make you (and applications) aware and not continue as if nothing happened. extfs doesn’t fail here because it cannot even detect that something is wrong.
btrfs has its own share of bugs but, in theory, this is actually a feature.
i have an ext4 and an ufs partition in the same hdd without any issues.
Not any issue that you know of. For all extfs (and, by extension, you) knows, the disk/cable/controller/whatever could have mangled your most precious files and it would be none the wiser; happily passing mangled data to applications.
You have backups of course (right?), so that’s not an issue you might say but if the filesystem isn’t integer, that can permeate to your backups because the backup tool reading those files is none the wiser too; it relies on the filesystem to return the correct data. If you don’t manually verify each and every file on a higher level (e.g. manual inspection or hashing) and prune old backups, this has potential for actual data loss.
If your hardware isn’t handling the storage of data as it should, you want to know.
even if we suppose this is the hardware’s fault and not btrfs’s, should a file system be a little bit more resilient than that? at this rate, i feel like a cosmic ray could set off a btrfs corruption.
While the behaviour upon encountering an issue is in theory correct, btrfs is quite fragile. Hardware issues shouldn’t happen but when they happen, you’re quite doomed because btrfs doesn’t have the option to continue despite the integrity of a part of it being compromised.
btrfs-restore
disables btrfs’ integrity; emulating extfs’s failure mode but it’s only for extracting files from the raw disks, not for continuing to use it as a filesystem.I don’t know enough about btrfs to know whether this is feasible but perhaps it could be made a bit more log-structured such that old data is overwritten first which would allow you to simply roll back the filesystem state to a wide range of previous generations, of which some are hopefully not corrupted. You’d then discard the newer generations which would allow you to keep using the filesystem.
You’d risk losing data that was written since that generation of course but that’s often a much lesser evil. This isn’t applicable to all kinds of corruption because older generations can become corrupted retroactively of course but at least a good amount of them I suspect.I don’t know enough about btrfs to know whether this is feasible but perhaps it could be made a bit more log-structured such that old data is overwritten first which would allow you to simply roll back the filesystem state to a wide range of previous generations, of which some are hopefully not corrupted. You’d then discard the newer generations which would allow you to keep using the filesystem.
i’m not sure i understand quite what you’re suggesting, but BTRFD is a copy on write filesystem
so when you write a block, you’re not writing over the old data: you’re writing to empty space, and then BTRFS is marking the old space as unused - or in the case of snapshots, marking it to be kept as old data
I am well aware of how CoW works. What I wrote does not stand in conflict with it.
Perhaps I wasn’t clear enough in what I said though:
Each metadata operation (“commit” I think it’s called) has a generation number; it first builds this generation (efficiently in a non-damaging way via CoW) and then atomically switches to it. The next generation is built with an incremented generation number and atomically switched again.
That’s my understanding of how btrfs generally operates.When things go awry, some sector that holds some of the newest generation may be corrupt but it might be that a relatively recent generation does not contain this data and is therefore unaffected.
What I’m suggesting is that you should be able to roll back to such a generation at the cost of the changes which happened in between in order to restore a usable filesystem. For this to be feasible, btrfs would need to take greater care not to overwrite recent generation data though which is what I meant by making it “more log-structured”.
I don’t know whether any of this is realistically doable though; my knowledge of btrfs isn’t enough to ascertain this.
as i said, maybe that’s the ideal for industrial/business applications (e.g. servers, remote storage) where the cost of replacing disks due to failure is already accounted for and the company has a process ready and pristine data integrity is of utmost importance, but for home use, reliability of the hardware you do have right now is more important than perfect data integrity, because i want to be as confident as possible that my system is going to boot up next time i turn it on. in my experience, i’ve never had any major data loss in ext4 due to hardware malfunction. also, most files on a filesystem are replaceable anyway (especially the system files), so it makes even less sense to install your system on a btrfs drive from that perspective.
what you’re saying me is basically “btrfs should never be advised for home use”
I mean, as someone who hasn’t encountered these same issues as you, I found btrfs really useful for home use. The snapshotting functionality is what gives me a safe feeling that I’ll be able to boot my system. On ext4, any OS update could break your system and you’d have to resort to backups or a reinstall to fix it.
But yeah, it’s quite possible that my hard drives were never old/bad enough that I ran into major issues…
honestly, i do get the appeal of btrfs, which is why i wanted to try it out one more time. but i feel i can’t trust it if it is really that fault intolerant. ext4 might not have as many features as btrfs, but it is more lenient and more predictable
(also, recovering from update failures should be the job of the package system imo)
Sad to hear. I don’t know if it’s luck or something else.
I’ve been running Debian on btrfs on my laptop for 3 months without issue; I still use ext4 on my desktop, as I just went with defaults when I installed the operating system.
I’ve had some issues with btrfs. I have a Fedora 41 box where the 1TB drive just magically lost 300+GB of capacity that shows up in use but there is nothing using it, and I used to have a 39/40 box where booting would take like 3+ mins that was all btrfs being unhappy with the primary drive on initial mount. Snapshots and the duplicate stuff are pretty killer features, though…
the 1TB drive just magically lost 300+GB of capacity that shows up in use but there is nothing using it
How did you verify that “nothing” is using it? That’s not a trivial task with btrfs because any given btrfs filesystem can contain an arbitrary amount of filesystem roots and that filesystem roots can be duplicated in seconds.
If you have ever done a snapshot or enabled automatic snapshots via e.g. snapper or btrbk, data that you have since deleted may still be present in a snapshot. Use
btrfs subvolume list /
to list all subvolumes and snapshots.If you ever feel lost in analysing btrfs data usage, you can use
btdu
to visually explore where data is located. Note that it never shows 100% accurate usage as it’s based on probabilistic sampling. It’s usually accurate enough to figure out what’s using your data after a little while though, so let it scan for a good minute.