Skip to content

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.

34 points49 comments
Open on Reddit
About this post
Posted
Archived
Score
34 · 100% up
Kind
Text
ID
5tpjms

Author

14
posts
94
comments
0
media
View profile

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.

23 points

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.

5 points
unknown author1 hidden

Deleted before we saved it.

4 points

It's because XFS scales better for enterprise workloads. The average home user probably won't notice much difference though.

6 points

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).

16 points

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.

10 points

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.

5 points

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.

8 points

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.

3 points

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.

6 points

Reliability is the most important thing. Who cares how fast it is if you can't trust it.

7 points

but I've been piping into /dev/null this whole time for those sick write speeds!

2 points

I dont know if its 'better' but i switched to JFS and have found it to perform really well.... worth checking out.

4 points

Some points to consider, and some answers:

  • You might want to segment the filesystem hierarchy across volumes for some fine control during snapshots/backups. e.g. /var is where stuff like databases, mail, and logs usually stay. Ideally, configure arch packages and caches elsewhere and snapshot often. :)
  • I don't think you can have sub mount points in btrfs, so that might have some impact on your configuration/decisions.
  • I associate XFS with scale. Enormous files, ridiculously high file counts, and huge bandwidth capabilities in parallel hardware configurations.
  • You can encrypt regardless of the filesystem, but it must be at the block level. e.g. The entire device/partition/volume is encrypted. e.g. see LVM/LUKS encryption.
  • Journaling is a decent protective layer which pre-writes a description of impending changes to a filesystem. If you lost power when writing data, the filesystem can "replay" the journal, which provides more metadata to help correct errors later and prevent something really awful from being half written to a filesystem. If you lose power when writing the journal, nothing of value is lost. It's just a very simple stop gap between power related errors and your storage. Of course there's a hit to performance with journaling, but for most uses it's perfectly reasonable.
  • OpenZFS is another excellent option. In short, it's more like Btrfs than XFS, but has been more rigorously tested by Sun/Oracle. These two (OpenZFS and Btrfs) are currently the only filesystems concerned with passive data corruption (bitrot) without using some additional parity check software or hardware.
  • If you care, I personally use Btrfs in a "raid1" configuration (mirrored) across multiple replaced drives for many years. It's just really nice and easy to use. The last time I had a major error was in 2009. The bugs were reported and fixed, but it did try writing outside of a partition container. Nothing of value was lost. Apparently some people experienced data loss when trying to use 'raid5', so don't.
3 points

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.

2 points

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.

1 points

'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!

1 points

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.

1 points

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.

3 points

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.

1 points

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.

3 points

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.

2 points

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.

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.

1 points

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.

2 points

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)

1 points

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)

2 points

I keep it boring on my laptop.

  • / - f2fs
  • /esp - fat32
  • /boot - bind mount of /esp/EFI/archlinux

I 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.

1 points
unknown author5 hidden

Deleted before we saved it.

2 points

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.

1 points
unknown author3 hidden

I'm happy with ext4. If it ain't broke don't fix it.

1 points

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.

1 points
unknown author1 hidden

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.

1 points

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.)

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.