61
submitted 1 month ago by bunitor@lemmy.eco.br to c/linux@lemmy.ml

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

top 50 comments
sorted by: hot top controversial new old
[-] dingdongitsabear@lemmy.ml 46 points 1 month ago

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.

[-] WalnutLum@lemmy.ml 12 points 1 month ago* (last edited 1 month ago)

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.

[-] Atemu@lemmy.ml 25 points 1 month ago

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.

[-] pupbiru@aussie.zone 3 points 1 month ago

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

[-] Atemu@lemmy.ml 3 points 1 month ago* (last edited 1 month ago)

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.

load more comments (1 replies)
load more comments (6 replies)
[-] BCsven@lemmy.ca 14 points 1 month ago

My system has been btrfs since 2017. No issues. Maybe you have random powerloss?

[-] dwt@feddit.org 11 points 1 month ago

You know, protecting against Powerloss was the major feature of filesystems in a time gone by…

[-] Atemu@lemmy.ml 5 points 1 month ago* (last edited 1 month ago)

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.

[-] FuckBigTech347@lemmygrad.ml 2 points 1 month ago

I had a drive where data would get silently corrupted after some time no matter what filesystem was on it. Machine's RAM tested fine. Turned out the write cache on the drive was bad! I was able to "fix" it by disabling the cache via hdparm until I was able to replace that drive.

[-] BCsven@lemmy.ca 4 points 1 month ago

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

[-] ReversalHatchery@beehaw.org 5 points 1 month ago

Maybe you have random powerloss?

who doesn't? even if rarely, but it just happens

[-] BCsven@lemmy.ca 2 points 1 month ago

I lost data on Windows in 2010. Since them I have had a decent UPS. Cheap insurance

[-] zarkanian@sh.itjust.works 12 points 1 month ago
load more comments (6 replies)
[-] sadTruth@lemmy.hogru.ch 12 points 1 month ago

I am running BTRFS on multiple PCs and Laptops since about 8-10 years ago, and i had 2 incidents:

  1. Cheap SSD: BTRFS reported errors, half a year later the SSD failed and never worked again.
  2. Unstable RAM: BTRFS reported errors, i did a memtest and found RAM was unstable.

I am using BTRFS RAID0 since about 6 years. Even there, i had 0 issues. In all those years BTRFS snapshoting has saved me countless hours when i accidentially misconfigured a program or did a accidential rm -r ~/xyz.

For me the real risk in BTRFS comes from snapper, which takes snapshots even when the disk is almost full. This has resulted in multiple systems not booting because there was no space left. That's why i prefer Timeshift for anything but my main PC.

[-] Endymion_Mallorn@kbin.melroy.org 10 points 1 month ago

This is just telling me that my loyalty to FAT(32) is valid.

[-] WalnutLum@lemmy.ml 9 points 1 month ago

I've had btrfs go into an error state because of a bad write before, but it was pretty easy to recover from

[-] Markaos@discuss.tchncs.de 8 points 1 month ago

My two cents: the only time I had an issue with Btrfs, it refused to mount without using a FS repair tool (and was fine afterwards, and I knew which files needed to be checked for possible corruption). When I had an issue with ext4, I didn't know about it until I tried to access an old file and it was 0 bytes - a completely silent corruption I found out probably months after it actually happened.

Both filesystems failed, but one at least notified me about it, while the second just "pretended" everything was fine while it ate my data.

[-] blackstrat@lemmy.fwgx.uk 6 points 1 month ago

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.

[-] LiamMayfair@lemmy.sdf.org 5 points 1 month ago

I can't comment on its server use cases or exotic workstation setups with RAID, NAS, etc. but I've been running Fedora on Btrfs for quite a few years now and I've had zero issues with it. Am I deliberately using all of its features like CoW, compression, snapshots...? No, but neither would your average Linux user who just wants something that works, like ext4.

I don't miss ext4, Btrfs worked for me since day 1.

[-] blackstrat@lemmy.fwgx.uk 3 points 1 month ago

So, what you're saying is, "it works on my machine"

[-] cool_pebble@aussie.zone 9 points 1 month ago

Aren't we all? Aren't Ext4 and ZFS considered mature because so many people have said "it works on my machine"?

I agree this person's experience may contrast to your own, but I don't think the fact that something has worked well for some people, and perhaps not for yourself, is a reason to discount it entirely.

[-] blackstrat@lemmy.fwgx.uk 3 points 1 month ago

I've never heard anyone say ZFS broke, corrupted their data or failed in any way at all. With btrfs it's a consistent complaint. And btrfs literally has modes of operation that are known to be broken. I could understand if it was a new file system, but it can almost drink in pubs.

load more comments (1 replies)
[-] data1701d@startrek.website 6 points 1 month ago

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.

[-] yozul@beehaw.org 5 points 1 month ago

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.

[-] ReversalHatchery@beehaw.org 5 points 1 month ago* (last edited 1 month ago)

being able to revert a failed upgrade by restoring a snapshot is not a power user need but a very basic feature for everyday users who do not want to debug every little problem that can go wrong, but just want to use their computer.

ext4 does not allow that.

[-] Unmapped@lemmy.ml 2 points 1 month ago

By using NixOS I can do this on ext4. Just reboot back to the previous image before the update. Not saying everyday users should be running nixos but there are other Immutable distros that can do the same.

[-] ReversalHatchery@beehaw.org 2 points 1 month ago

will that also restore your data? what happens when a program updates its database structure with the update, and the old version you restore won't understand it anymore?

[-] Unmapped@lemmy.ml 2 points 1 month ago

That is a good point. I've only had to rollback twice and nether time had any issues. But from my understanding of how it works, you are correct, the data wouldn't rollback.

[-] ReversalHatchery@beehaw.org 2 points 1 month ago

I've learned this lesson with my Android phone a few years ago. There it was actually about sqlite databases of a system app (contacts I think?), but this can happen with other formats too. Worst is if it doesn't just error out, but tries to work with "garbage", because it'll possibly take much more time to debug it, or even realize that your data is corrupt.

[-] yozul@beehaw.org 2 points 1 month ago

You know file systems are not the only way to do that, right? Heck, Timeshift is explicitly designed to do that easily and automatically without ever even having to look at a command line. Backup before upgrade is a weird thing to cram into a file system.

load more comments (1 replies)
[-] ProgrammingSocks@pawb.social 2 points 1 month ago* (last edited 1 month ago)

Copy on write, compression, and snapshots are really good whistles, though.

load more comments (3 replies)
[-] fmstrat@lemmy.nowsci.com 3 points 1 month ago

Won't say it.. Won't say it.. ZFS!! Oops.

load more comments (4 replies)
[-] jaypatelani@lemmy.ml 3 points 1 month ago
load more comments (4 replies)
[-] unknowing8343@discuss.tchncs.de 3 points 1 month ago

Been using BTRFS since I learned I could squeeze more data on my cheap-ass drive and... It's been 3 years, no problem at all, and I have backups anyway.

load more comments
view more: next ›
this post was submitted on 23 Nov 2024
61 points (85.1% liked)

Linux

48721 readers
1378 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS