this post was submitted on 23 Nov 2024
38 points (93.2% liked)

Selfhosted

40329 readers
382 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

About a year ago I switched to ZFS for Proxmox so that I wouldn't be running technology preview.

Btrfs gave me no issues for years and I even replaced a dying disk with no issues. I use raid 1 for my Proxmox machines. Anyway I moved to ZFS and it has been a less that ideal experience. The separate kernel modules mean that I can't downgrade the kernel plus the performance on my hardware is abysmal. I get only like 50-100mb/s vs the several hundred I would get with btrfs.

Any reason I shouldn't go back to btrfs? There seems to be a community fear of btrfs eating data or having unexplainable errors. That is sad to hear as btrfs has had lots of time to mature in the last 8 years. I would never have considered it 5-6 years ago but now it seems like a solid choice.

Anyone else pondering or using btrfs? It seems like a solid choice.

top 46 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 1 hour ago (1 children)

My setup is different to yours but not totally different. I run ESXi 8, and I started to use BTRFS on some of my VM's.

I had a power failure, that was longer than the UPS could handle. Most of the system shutdown safely, a few VM's did not. All of the EXT4 VM's were easily recovered (including another one that was XFS). TWO of the BTRFS systems crashed into a non recoverable state.

Nothing I could do to fix them, they were just toast. I had no choice but to recover using backups. This made me highly aware that BTRFS is still not a reliable FS.

I am migrating everything from BTRFS to something more stable and reliable like EXT4. It's simply not worth the headache.

[–] [email protected] 1 points 1 hour ago

When did this happen?

[–] [email protected] 5 points 3 hours ago

Did you set the correct block size for your disk? Especially modern SSDs like to pretend they have 512B sectors for some compatibility reason, while the hardware can only do 4k sectors. Make sure to set ashift=12.

Proxmox also uses a very small volblocksize by default. This mostly applies to RAIDz, but try using a higher value like 64k. (Default on Proxmox is 8k or 16k on newer versions)

https://discourse.practicalzfs.com/t/psa-raidz2-proxmox-efficiency-performance/1694

[–] [email protected] 21 points 7 hours ago (1 children)

Don't use btrfs if you need RAID 5 or 6.

The RAID56 feature provides striping and parity over several devices, same as the traditional RAID5/6. There are some implementation and design deficiencies that make it unreliable for some corner cases and the feature should not be used in production, only for evaluation or testing. The power failure safety for metadata with RAID56 is not 100%.

https://btrfs.readthedocs.io/en/latest/btrfs-man5.html#raid56-status-and-recommended-practices

[–] [email protected] 3 points 1 hour ago

Or run the raid 5 or 6 separately, with hardware raid or mdadm

Even for simple mirroring there's an argument to be made for running it separately from btrfs using mdadm. You do lose the benefit of btrfs being able to automatically pick the valid copy on localised corruption, but the admin tools are easier to use and more proven in a case of full disk failure, and if you run an encrypted block device you need to encrypt half as much stuff.

[–] [email protected] 11 points 6 hours ago (1 children)

You shouldn't have abysmal performance with ZFS. Something must be up.

[–] [email protected] 0 points 6 hours ago* (last edited 6 hours ago) (1 children)

What's up is ZFS. It is solid but the architecture is very dated at this point.

There are about a hundred different settings I could try to change but at some point it is easier to go btrfs where it works out of the box.

[–] [email protected] 5 points 3 hours ago

Since most people with decently simple setups don't have the described problem likely somethings up with your setup.

Yes ifta old and yes it's complicated but it doesn't have to be to get a decent performance.

[–] [email protected] 5 points 5 hours ago (2 children)

One day I had a power outage and I wasn't able to mount the btrfs system disk anymore. I could mount it in another Linux but I wasn't able to boot from it anymore. I was very pissed, lost a whole day of work

[–] [email protected] 1 points 1 hour ago

When did this happen?

[–] [email protected] 1 points 4 hours ago

ACID go brrr

[–] [email protected] 28 points 9 hours ago (2 children)

A bit of topic; am I the only one that pronounces it "butterface"?

[–] [email protected] 34 points 8 hours ago (1 children)
[–] [email protected] 24 points 8 hours ago

You son of a bitch, I'm in.

[–] [email protected] 15 points 8 hours ago

Ah feck. Not any more.

[–] [email protected] 7 points 6 hours ago (2 children)

I've been using single-disk btrfs for my rootfs on every system for almost a decade. Great for snapshots while still being an in-tree driver. I also like being able to use subvolumes to treat / and /home (maybe others) similar to separate filesystems without actually being different partitions.

I had used it for my NAS array too, with btrfs raid1 (on top of luks), but migrated that over to ZFS a couple years ago because I wanted to get more usable storage space for the same money. btrfs raid5 is widely reported to be flawed and seemed to be in purgatory of never being fixed, so I moved to raidz1 instead.

One thing I miss is heterogenous arrays: with btrfs I can gradually upgrade my storage one disk at a time (without rewriting the filesystem) and it uses all of my space. For example, two 12TB drives, two 8TB drives, and one 4TB drive adds up to 44TB and raid1 cuts that in half to 22TB effective space. ZFS doesn't do that. Before I could migrate to ZFS I had to commit to buying a bunch of new drives (5x12TB not counting the backup array) so that every drive is the same size and I felt confident it would be enough space to last me a long time since growing it after the fact is a burden.

[–] [email protected] 2 points 6 hours ago

With version 2.3 (currently in RC), ZFS will at least support RAIDZ expansion. That should already help a lot for a NAS usecase.

[–] [email protected] 0 points 6 hours ago

Btrfs Raid 10 reportedly is stable

[–] [email protected] 4 points 6 hours ago (1 children)

One time I had a power outage and one of the btrfs hds (not in a raid) couldn't be read anymore after reboot. Even with help from the (official) btrfs mailinglist It was impossible to repair the file system. After a lot of low level tinkering I was able to retrieve the files, but the file system itself was absolutely broken, no repair process was possible. I since switched to zfs, the emergency options are much more capable.

[–] [email protected] 4 points 6 hours ago

Was that less than 2 years ago? Were you using kernel 5.15 or newer?

[–] [email protected] 23 points 9 hours ago (1 children)

No reason not to. Old reputations die hard, but it's been many many years since I've had an issue.

I like also that btrfs is a lot more flexible than ZFS which is pretty strict about the size and number of disks, whereas you can upgrade a btrfs array ad hoc.

I'll add to avoid RAID5/6 as that is still not considered safe, but you mentioned RAID1 which has no issues.

[–] [email protected] 3 points 8 hours ago (2 children)

I've been vaguely planning on using btrfs in raid5 for my next storage upgrade. Is it really so bad?

[–] [email protected] 1 points 1 hour ago

It's affected by the write-hole phenomenon. In BTRFS case that can mean that perfectly good old data might corrupt without any notice.

[–] [email protected] 6 points 7 hours ago

Check status here. It looks like it may be a little better than the past, but I'm not sure I'd trust it.

An alternative approach I use is mergerfs + snapraid + snapraid-btrfs. This isn't the best idea for a system drive, but if it's something like a NAS it works well and snapraid-btrfs doesn't have the write hole issues that normal snapraid does since it operates on r/o snapshots instead of raw data.

[–] [email protected] 2 points 7 hours ago

Not proxmox-specific, but I've been using btrfs on my servers and laptops for the past 6 years with zero issues. The only times it's bugged out is due to bad hardware, and having the filesystem shouting at me to make me aware of that was fantastic.

The only place I don't use zfs is for my nas data drives (since I want raidz2, and btrfs raid5 is hella shady) but the nas rootfs is btrfs.

[–] [email protected] 2 points 7 hours ago (1 children)

The question is how do you get a bad performance with ZFS?

I just tried to read a large file and it gave me uncached 280 MB/s from two mirrored HDDs.

The fourth run (obviously cached) gave me over 3.8 GB/s.

[–] [email protected] 1 points 6 hours ago* (last edited 6 hours ago) (3 children)

I have never heard of anyone getting those speeds without dedicated high end hardware

Also the write will always be your bottleneck.

[–] [email protected] 2 points 4 hours ago* (last edited 3 hours ago)

This is an old PC (Intel i7 3770K) with 2 HDDs (16 TB) attached to onboard SATA3 controller, 16 GB RAM and 1 SSD (120 GB). Nothing special. And it's quite busy because it's my home server with a VM and containers.

[–] [email protected] 2 points 5 hours ago* (last edited 5 hours ago) (1 children)

I'm seeing very similar speeds on my two-HDD RAID1. The computer has an AMD 8500G CPU but the load from ZFS is minimal. Reading / writing a 50GB /dev/urandom file (larger than the cache) gives me:

  • 169 MB/s write
  • 254 MB/s read

What's your setup?

[–] [email protected] 1 points 4 hours ago (1 children)

Maybe I am CPU bottlenecked. I have a mix of i5-8500 and i7-6700k

The drives are a mix but I get almost the same performance across machines

[–] [email protected] 1 points 4 hours ago

It's possible, but you should be able to see it quite easily. In my case, the CPU utilization was very low, so the same test should also not be CPU-bottlenecked on your system.

[–] [email protected] 2 points 5 hours ago (1 children)

I have similar speeds on a truenas that I installed on a simple i3 8100

[–] [email protected] 1 points 4 hours ago (1 children)

How much ram and what is the drive size?

I suspect this also could be an issue with SSDs. I have seen a lot a posts around describing similar performance on SSDs.

[–] [email protected] 1 points 2 hours ago

64 gb of ecc ram (48gb cache used by zfs) with 2tb drives (3 of them)

[–] [email protected] 5 points 10 hours ago

If it didn't give you problems, go for it. I've run it for years and never had issues either.

[–] [email protected] 2 points 8 hours ago (2 children)

Meh. I run proxmox and other boot drives on ext4, data drives on xfs. I don't have any need for additional features in btrfs. Shrinking would be nice, so maybe someday I'll use ext4 for data too.

I started with zfs instead of RAID, but I found I spent way too much time trying to manage RAM and tuning it, whereas I could just configure RAID 10 once and be done with it. The performance differences are insignificant, since most of the work it does happens in the background.

You can benchmark them if you care about performance. You can find plenty of discussion by googling "ext vs xfs vs btrfs" or whichever ones you're considering. They haven't changed that much in the past few years.

[–] [email protected] 2 points 7 hours ago (1 children)

but I found I spent way too much time trying to manage RAM and tuning it,

I spent none, and it works fine. what was you're issue?

[–] [email protected] 1 points 7 hours ago

I have four 6tb data drives and 32gb of RAM. When I set them up with zfs, it claimed quite a few gb of RAM for its cache. I tried allocating some of the other NVMe drive as cache, and tried to reduce RAM usage to reasonable levels, but like I said, I found that I was spending a lot of time fiddling instead of just configuring RAID and have it running just fine in much less time.

[–] [email protected] 1 points 6 hours ago

Proxmox only supports btrfs or ZFS

Or at least that's what I thought

[–] [email protected] 2 points 9 hours ago

Using it here. Love the flexibility and features.

[–] [email protected] 2 points 9 hours ago

I run it now because I wanted to try it. I haven't had any issues. A friend recommended it as a stable option.

[–] [email protected] 1 points 8 hours ago (1 children)

Btrfs only has issues with raid 5. Works well for raid 1 and 0. No reason to change if it works for you

[–] [email protected] 1 points 6 hours ago

It is stable with raid 0,1 and 10.

Raid 5 and 6 are dangerous

[–] [email protected] 1 points 8 hours ago (1 children)

Do you rely on snapshotting and journaling? If so backup your snapshots.

[–] [email protected] 1 points 6 hours ago (1 children)

Why?

I already take backups but I'm curious if you have had any serious issues

[–] [email protected] 1 points 1 hour ago

Are you backing up files from the FS or sre you backing up the snapshots? I had a corrupted journal from a power outage that borked my install. Could not get to the snapshots on boot. Booted into a live disk and recovered the snapshot that way. Would've taken hours to restore from a standard backup, however it was minutes restoring the snapshot.

If you're not backing up BTRFS snapshots and just backing up files you're better off just using ext4.

https://github.com/digint/btrbk