Which is the better filesystem?
I have been wanting to install arch for a long time, ever since manjaro has been giving me issues here and there. Before learning the arch way, I need to have a stable distro on my personal computer due to work/life reasons.
I have opensuse as my stable distro, and I know that the filesystem it uses is btrfs for root, and xfs for home. I understand what btrfs excels at (the CoW system) and I have some ideas on how to install arch on a btrfs partition. (and will start practicing on virtualbox soon) However, I don't know the reasoning behind having subvolumes for specific folders and not the others on the filetree. (Some guides just do one subvolume, others do seperate for /var, /opt etc. ) I would like to know the mativation behind these so i can determine what is the best course of action. (btrfs seems to be the perfect filesystem for the root installation, as I can use snapper to roll back if I break something or windows partition decides to butcher my other operating systems)
Also, I would like to know the motivation behind using xfs for home partition. So far, I haven't seen anything regarding encryption of xfs filesystems (which is a must for my home partition) so I don't know if its a good option. I also don't know the benefits of journaling to be honest.
Any help/suggestions would be appreciated.
About this post
- Posted
- Archived
- Score
- 34 · 100% up
- Kind
- Text
- ID
- 5tpjms
52 comments
I'd consider ext4 a better choice than xfs for the average user, if for no other reason than the fact xfs can't be shrunk (at least not easily) if the need ever arises.
XFS has a much cleaner codebase and is considered to be more reliable. Ext4, though, has proven to be very reliable despite developers having nightmares after looking at the code. Also, recovery utils for ext4 are much better than for xfs.
For the average end user, both are very good choices. I'd say to go with whatever the distribution recommends.
Unless you need special features, that is. For example, ext4 can be shrunk, xfs supports convenient live file systems dumps, etc.
Deleted before we saved it.
It's because XFS scales better for enterprise workloads. The average home user probably won't notice much difference though.
Every few years I give btrfs another chance, and every time I end up losing my entire root filesystem and have to rebuild from scratch on ext4 (which has never failed me).
How? What kind of hardware were you putting it on. Btrfs works fine for me but i have heard horror stories and I am just waiting for the day.
The hardware is fine. Just regular SSDs that have been reliable otherwise. Usually when I have a system crash and have to hard reboot is when btrfs fails to recover.
Weird, I've got 3 arch systems with btrfs root and I've not had a problem in a couple years. I did see that news item about the one kernel that had a problem though so perhaps I dodged a bullet there.
The laptop I setup is single ssd but the servers are both using multiple disk redundancy. Although really if btrfs does something wrong I suppose that would mean I have multiple wrong copies.
Gonna agree with this.
I'm an unstable used, who often uses mainline kernel, and often has to hard reboot. I've been using btrfs with docker running on it, with subvolumes for root an home, and I've never lost the disk. I do reinstall about once a year though.
Running BTRFS on several production systems for 2+ years without a single problem. Hard power fails and all. Not a single hiccup.
Experiences seem to vary a lot.
SATA power saving bug?
I don't know. Happened with different computers, different drives.
Reliability is the most important thing. Who cares how fast it is if you can't trust it.
but I've been piping into /dev/null this whole time for those sick write speeds!
I dont know if its 'better' but i switched to JFS and have found it to perform really well.... worth checking out.
I've never lost data with JFS. I have with EXT4 and XFS.
Could you elaborate on the lost data?
What was the cause? Why would JFS handle that better?
Some points to consider, and some answers:
If I recall correctly, the data loss issue associated with raid 5 you mention was fixed in kernel 3.19. I agree though, use raid 1 unless you really need raid 5, want to try it out, or know what you are doing.
Seems like i dont really need xfs tbh. The main reason I wanted to have it as such was because I was curious about opensuse defaulting into that and I've hear xfs is good for 'large files, infrequent access' which screams home directory to me.
I think that the kind of thing which the XFS developers mean when they talk about "large files" is a couple of orders of magnitude larger than what a typical user would have in their home directory.
Unless you typically keep files of 10s or 100s of gigabytes in ~. But most people don't!
OpenZFS has no connection to Oracle/Sun, other than being started by some of the original ZFS developers, including Matt Ahrens.
Oracle stopped supporting open source implementations in 2010. No new code has been included from Oracle/Sun since then.
I love ZFS, but have not been brave enough to try it under Linux.
You mention snapper. One reason to use subvolumes in that case is that snapper runs on a subvolumes. So I have subvolumes for my documents and my photos and my Utils. Each has different snapper settings for lengh of time to retain the data. If you run snapper on root, you'd probably want the package cache to be it's own subvolume as you don't want to keep images of that over time.
Encryption can be done with dm-crypt and Luks. That operates under the filesystem layer. My laptop is fully encrypted with a BTRFS root and home. If your drive supports it and you can give up the ability to have your system sleep, OPAL is also a way to encrypt a whole system (self-encrpting hard drives). Journaling offers some protection for data loss on an unclean shutdown or crash. COW probably offers more.
The arch wiki offers a good bit of information on these topics.
Im on a notebook so power outages are not a thing. Looks like i can get away with no journaling, at least until i build a server to source off my gaming and computations. The only remaining issue i would have is if my home is a btrfs subvolume; which i usually like keeping seperate but i guess i don't really have to.
Well, crashes still can happen. Journaling FS are pretty much "standard" these days. ext3, ext4, XFS, JFS, are all Journaling. BTRFS and ZFS are the "next level" of fancy stuff.
You can make home it's own partition and make it a separate FS from root if you want. It can making wiping and reinstalling easier as you just keep /home and rebuild a new /. I presently don't do that on my laptop; it's one VFAT EFI partition and one BTRFS partition. I don't even have home as a separate subvolume. On my data server, my data is on it's own BTRFS volume separate from root.
If you use BTRFS and you use a laptop with power savings (for example the program TLP) consider changing [https://wiki.archlinux.org/index.php/TLP#Btrfs](this setting).
Regardless of file system chosen, I'd suggest keeping your data on another offline drive - external USB, cloud, whatever. For that rainy day.
I used to use openSUSE Tumbleweed and I switched to Arch recently. I chose to use EXT4 for my /home directory and btrfs for the root filesystem. Throughout my years on openSUSE, btrfs never really gave me any issues except when a hard drive started going loco on me but that was a hardware issue.
The advantage of using btrfs is having tools like snapper. If you borked your system with a faulty update, you can roll back seamlessly using GRUB. This was a blessing on openSUSE when Tumbleweed's kernel was updated to one that NVIDIA's binary drivers don't yet support for example. Not just that, if you mess with things around too much, you can go back to the very first snapshot that was created right after the system was installed giving you the power to use a factory reset without having to spend time reinstalling it like some would do.
Can you explain how this is different than just making an LVM snapshot before you update?
LVM snapshot -> update -> rollback if things go tits up.
It is not, but unlike btrfs/zfs, LVM snapshots have a negative performance impact.
I have different Btrfs subvolumes for /, /opt, /var/log, /var/cache/pacman/pkg, and of course the snapshots directory itself. Snapper only tracks / for me.
Why? The way Btrfs snapshots work is by only writing what has changed since the last snapshot. So for example if your logs directory is included in your snapshot, it will constantly be growing and using unnecessary space. Of course I want to backup /etc, etc... But I don't want my snapshots to take up too much space.
So everything you don't need to have backed up, put in its own subvolume.
thanks! seems like really elementary stuff to consider if youre planning on using a tool to manage these (like I'm planning to use snapper)
btrfs by a long way - more features, more flexible.
for the horror stories:
1 - i takes a decade to fully develop a new file system and i believe btrfs is now stable on most use cases.
2 - taken from a higher level, im sure rollbacks now save many more systems than corner case fs corruptions.
for sub-volumes:
1 - separate directories for snapshot management
2 - selectively turn off COW for disk thrashing apps (databases, VMs)
I keep it boring on my laptop.
/- f2fs/esp- fat32/boot- bind mount of/esp/EFI/archlinuxI take the approach that backups are a function of a different layer. The filesystems' job is to put data on the disk. So far, I've been too lazy to learn any features a fs may provide.
Deleted before we saved it.
No... the installation ISO uses squashfs or something similar for root. I'm not sure what you are asking? I know it is dead simple, but that is by design.
I'm happy with ext4. If it ain't broke don't fix it.
It was broken again and again. For a while in the last year and a half, I'd pull from the Linux kernel repo, and see these hilarious ext4 data corruption bugs. It's a myth that ext4 is perfectly stable (not that I'm claiming you claimed that). Every massive piece of code like ext4 has very interesting bugs and design defects. One of the local kernel hackers that I sometimes would meet and I discussed certain rather interesting locking ext4 would do, and the convoluted debugging he had to pull off to fix certain deadlocks and data losses.
Unless you really need filesystem layer, integrated rather than overlaid encryption, just use LUKS or eCryptFS. Should have been obvious from the Arch Wiki. Not even sure if regular users, not kernel developers (I don't just mean kernel-aware) use ext4's encryption features.
TBH it never failed me. My PC runs fine. I'm not a developer i don't know much about code. It just works for now.
Just use NTFS
the open source version is crippled - check the speeds
NEVER!
I use btrfs for my mirrored SSDs / filesystem and an md raid1 for my fat32 EFI /boot with metadata 0.9 to make that possible. A 2x 12x 4T raidz3 pool lives at /data and a 12x 8T SMR raidz3 at /cold for data storage. I haven't setup encryption, I'm hoping it'll come to ZFS natively w/in my lifetime.
I think btrfs is ideal for / because it works and is in the kernel and is easy. And /boot is fat32 because it is easy to use with EFI, md's raid1 on it for redundancy. And ZFS is best for the data because of verify on read and proven stability and reliability (unlike btrfs's raid5/6 which should not be used until they resolve all the issues w/ it and it spends a few years getting proven... again.)