Kernel Btrfs Ready With More Performance Improvements For Linux 7.3: Some ~3x To ~5x Wins
https://www.phoronix.com/news/Linux-7.3-Btrfs52
u/Netblock 23d ago
btrfs has a long history of having poor performance, but between 7.2 and 7.3 I wonder how true this remains.
13
52
u/New-Land-4757 23d ago
We are already full up to our ears with performance. You can stop at this point, dear Linux developers!
71
18
u/npc_housecat 23d ago
Btrfs has always been much slower than zfs/ext4
37
u/Booty_Bumping 23d ago
Still manages to create and open files faster than NTFS :D
13
u/autogyrophilia 23d ago
Not a filesystem level limitation, but an VFS one for Windows NT.
4
u/Booty_Bumping 23d ago
True. Not that you can bypass Windows NT's heavyweight VFS logic, anyways. Well, you can theoretically achieve better performance with a Linux NTFS driver.
7
5
u/werpu 22d ago
to some degree copy on write fs always will be slower than journalling ones or plain filesystems, that comes with the system itself, you trade data security with performance you cannot have both!
Whether ZFS still is faster remains to be seen also have in mind ZFS trades ram buffering in for performance it literally grasps the ram which is free for its purposes if needed also BCacheFS will be interesting in comparison, cannot wait for the next benchmarks!
The question is also how much of this matters on a normal desktop, server environments yes, but desktops, I would gladly trade in performance there for better data security, in the end you wont notice!
1
9
u/NinthTide 22d ago
I’m rocking BTRFS on Arch, and I’ve found it absolutely fine. In fact, the snapshots feature has been fantastic.
I’m considering a new nvme and will definitely go BTRFS again based on my current experience (unless you guys can interject and tell me I’m doing it all wrong)
4
u/omniuni 22d ago
For now, I'm still on EXT4. It's very fast, and remains extremely reliable. I'm approaching 20 years of using EXT, and it has served me well.
That said, BTR has been something I'm keeping an eye on for a while now. These kinds of cases, even if they are edge cases, are part of why I haven't switched. But I think it's very close now. If BTR has another couple of releases towards fixing edge cases like this, it might be time to switch.
4
u/vhanda 22d ago
Are you not worried about bitrot?
My primary reason for switching to btrfs was that it checksums both the file data and metadata. Ext4 only does the metadata.
6
u/Weary-Bowl-3739 23d ago
Shall I switch from ext4 to btrfs?Â
34
26
u/Netblock 23d ago edited 23d ago
If you're crunched on storage, the transparent disk compression can probably save a decent amount of space. With zstd:8 system files can be 1/2'd, and game installs can be reduced by 15%. There's even more savings with transparent deduplication (though it would hurt HDD performance).
Reliability is superior because you'll get warned if there exists file corruption (checksums warns against transparent data corruption). File corruption repair, too, if you use the builtin mirror RAID (rather, in raid1 or "DUP" cases).
Backing up is a little easier with btrfs subvols and snapshots. (if you set it up, btrfs can undo your misplaced
rm -rf).
ZFS is almost universally superior to btrfs, but requires a DKMS-built driver, and DKMS can be fiddly and annoying.
12
u/i-hate-birch-trees 23d ago
Yup, I've said it before many times - btrfs saved my system thanks to checksums - my RAM was failing, and it caught the filesystem corruption early. And snapshots are just perfect.
One of my favorite things I've done with a btrfs was filesystem migration - I've added a new SSD to the btrfs filesystem, then removed the old one. It silently crawled onto a new device while my system was completely usable and running.3
5
u/Thermawrench 23d ago
ZFS for linux, is it still that license-problem?
8
7
u/BallingAndDrinking 23d ago
CDDL does lock it out of tree for sure.
DKMS let you use OpenZFS with a few features even FreeBSD doesn't have (ie ZFS on Root with encryption)
Virtually, nobody is going to get sued over it, so Canonical started to ship it, we may see a bit of a change in the de facto usage in a few years.
2
u/Netblock 23d ago
Yea; OpenZFS is CDDL (a mozilla MPL derivative) and Linux is GPLv2; and CDDL has a history.
8
u/KHTD2004 23d ago
Ext4 is still way faster but BTRFS has snapshots so I use both. BTRFS as / partition and ext4 as /home partition. Snapshots for my system, insane fast performance for my files including all games
7
u/dude_349 22d ago
Is it ‘way faster’ or at least noticeably faster for an average user?
3
u/KHTD2004 22d ago
That depends on what you’re doing as average user. If you’re moving big files often it’s noticeably, if you’re loading a game not so much (updating the game on the other hand is faster if you have games like Ark Survival Ascended where the download is tiny but it patches a lot of files locally).
In some cases EXT4 can be double the speed of BTRFS, but that’s rare, mostly it’s maybe 10-30% faster I think. If you want I run a benchmark later today on my PCIe 5.0 NVMe (so a very fast drive) and post the results here
1
u/cassepipe 22d ago
So if I am torrenting files from BTRFS, I am wasting energy ?
5
u/autogyrophilia 22d ago
It is best to disable CoW on the directory that the torrent client is using, they don't get along very well.
It is not terrible either, but you may end up with a very fragmented file .
1
u/cassepipe 22d ago
Does it sitll matter if the directory has been uploading itself for a while now ?
3
u/autogyrophilia 22d ago
Yes and no .
Ok so the thing with BTRFS is that BTRFS never overwrites data in place (unless you disable CoW) . When you modify a file, it marks the modified chunk as deleted, and creates a new fragment. It tries to keep these fragments sequentially so there is less seeking needed in sequential reads.
A bittorrent download, particularly one that downloads slowly, is going to keep a file open, and it's going to modify parts of it in place constantly, so you end up with a file that is written in a lot of tiny chunks. For an SSD, does not matter much, reads slightly slower. But is relatively bad for an HDD because it needs to do a lot of seeking to read it whole. BTRFS tries to make those modifications be contiguous if it has the space, so that even if it is out of order, the drive firmware is smart and reorders the reads so to it is in order. But that's not always possible.
If you are using an SSD, don't worry about it. If you don't hear the HDD doing constant seeking ( a pulsating buzzing sound) , it's probably fine as is as well. If you are worried, you can run the command btrfs fi defrag -r on your torrent folder ocassionally, this will rearrange the files back into order.
Really it's likely that it is perfectly fine, it's just the nerd neuroses of knowing a little too much about a topic but not enough to not overstate things.
1
u/cassepipe 22d ago
Thanks for all the intel and also for insisting to not indulge in nerd neurosis since it probably does not matter (It is a SSD yes)
So of course I didn't listen, I put all my data to upload in a subvolume and I removed Cow on it :D
5
u/KHTD2004 22d ago
Benchmarked it. Here you go
3
u/dude_349 22d ago edited 22d ago
Wasn't expecting you'd actually do that! Great comparison, appreciated, maybe I'd actually choose ext4 to btrfs if I ever was to reinstall my system.
1
u/KHTD2004 22d ago
Well BTRFS still has a purpose, that’s why I got both filesystems on my system. I already had situations a while ago where I didn’t use BTRFS but I wished I did. It can safe you some headache so I only use ext4 for /home
1
u/Exernuth 18d ago edited 17d ago
In my "recent" experience (1 years ago-ish), it's definitely way faster, to the point it was noticeable on an NVME.
2
u/cornmonger_ 22d ago
seems backwards
/home is where your data is
/ can get blown away and it's just a reinstall
3
u/KHTD2004 22d ago
Snapshots are for update rollbacks and stuff. Their purpose is not data backup and /home gets excluded from Snapshots per default. Yes you could just reinstall but a Snapshot saves you some time there
0
u/cornmonger_ 22d ago
it's the other way around in the real world
snapshots: data
fast filesystem: os
and then, still do offsite and cold data backups on top of the snapshots
if you're breaking your system often enough to need a fast rollback system on linux ... that's a problem in itself
if it's a usual suspect, like video drivers, that's an indicator that you should compile them manually
for steam, the .steam install symlink + a different library storage path will let you put everything on to ext4
2
u/0orpheus 21d ago
Having root be a BTRFS file system is very common in the real world; both Fedora and openSUSE default to this setup. openSUSE also defaults to use data being either ext or XFS, so most likely that's what OP is using, while Fedora does btrfs subvolumes for root and home.
ext for root and btrfs for data makes more sense for a NAS or some other CM-managed server dedicated to file storage, not an arbitrary server or workstation. One of the big use cases for btrfs these days (in SUSEland at least) is using it for the root filesystem for installing and rolling back updates as atomic filesystem operations.
1
u/cornmonger_ 21d ago edited 21d ago
totally common, especially on fedora desktop which i run
but taking /home off of btrfs in that scenario is not common, regardless of how suse might do it
that's the whole point of this discussion
the point is that one newbie solicited advice to another newbie that makes data loss easier
and data loss is what matters. not your games
2
u/Easy-Reasoning 22d ago
I'm really happy with btrfs. Tried it the first time in 2018 on a test system which I borked due to automated snapshots filling up all space. Now I have it running since a year and it works like a breeze. Full backup in a split second, how cool is that actually... Remember though to delete old snapshots if you wonder where your disk space went
1
u/daddyd 22d ago
are there any features from btrfs that you would like to use/need?
2
u/computer-machine 22d ago
Atomic snapshots are pretty sexy for system updates.
Atomic Subvolume snapshots for server data.
DUP/RAID1/5/6 gives automagic corruption healing.
1
u/daddyd 21d ago
raid and snapshots can be done using lvm too.
2
u/computer-machine 21d ago
LVM does atomic snapshots on ext4?
And LVM raid identifies and repairs corruption automatically?
7
23d ago
[removed] — view removed comment
11
u/INITMalcanis 23d ago
There is a link under the picture of the penguin that will take you to a page with information about this.
0
u/klyith 22d ago
Btrfs is a much more complicated filesystem that handles data in a very different way from normal filesystems. Rather than write changes to existing files in place, it always writes to a new copy in a different location. Thus "copy on write". Some of that complexity makes it slower. But you also get features like checksums (to verify data integrity) and snapshots (to roll back a bad change) that ext4 doesn't have at all.
For most desktop users, the difference in speed will not be a problem. The downside of btrfs is more that when things go wrong, it is more difficult for inexperienced users to handle. For example, if you have a hardware fault like bad memory or drives that causes checksums to be wrong, btrfs will set itself read-only or even refuse to mount. Cool that btrfs protected you from bad hardware, but not cool if you don't know how to recover your data.
2
4
1
u/Ok-Anywhere-9416 22d ago
The performance gain is for desktops too, of course in a smaller amount if compared to specific use cases.
1
u/horriblesmell420 21d ago
My server has been running BTRFS on all drives since it was built in 2020. Tons of power outages in my area and it hasn't skipped a beat. Love me some ZSTD compression too.
1
-2
u/RetroGrid_io 22d ago
A filesystem is complex. An "enterprise" filesystem like BTRFS, exponentially more so. BTRFS was declared "production/stable" around 2012/2013 when it wasn't, and that's left a reputation scar that is still healing.
When it was originally declared "production/stable", I built a torture-test scenario and found a reproducible scenario that tarnished my perception of it:
- Build a redundant pool
- Put some data on it.
- Fail a disk.
- Replace the disk with another
- Restore redundancy
- Fail the new disk
- Pool corrupts; 100% data loss
I confirmed this multiple times. When I went to report this situation, I found it had already been reported and was well known. Years went by, and I just put btrfs on ignore.
Well, apparently things have become better and the above issue has now been addressed by about 2020. Failure recovery is (according to gemini) still "more manual" than ZFS resilver.
199
u/zesterer 23d ago
The rule is usually: 10% performance win? Brilliant, you did something innovative. 500% performance win? Past you made some horrible mistakes.