ext4 vs XFS vs ZFS - Linux Filesystems Compared
A filesystem choice question sounds simple, but it quietly tests whether you understand production tradeoffs or just have a favorite. Interviewers use it as a quick filter before moving into harder storage questions.
The answer interviewers want
Think of filesystems like car engines. ext4 is your reliable sedan: stable, widely supported, and good enough for most workloads. XFS is the sports car: built for speed and large files. ZFS is the heavily instrumented vehicle with built-in safety systems: more overhead, but it gives you guarantees the others don't.
In production, the general guidance is:
- Use
ext4for general-purpose servers. It's the safe default when you don't have a specific reason to deviate. - Use
XFSfor databases and large file storage, where its strength with big files and throughput pays off. - Use
ZFSwhen you need snapshots and data integrity guarantees, not just raw speed.
The part most people leave out: ZFS is expensive in RAM. It's commonly understood to need a serious memory budget, at least 8GB just for the filesystem layer, before you even account for your application. That's why a lot of startups can't justify it for every box. They end up reserving it for the systems where snapshots and integrity checks actually matter, and running ext4 or XFS everywhere else.
Why interviewers ask this
They're checking if you reason about tradeoffs instead of reciting a default. A good answer ties filesystem choice to workload type (small files vs large files vs databases) and to operational cost (RAM, complexity), not just to "what I've always used." It also signals whether you've actually run something like ZFS in a resource-constrained environment and hit its limits.
Follow-ups to expect
Why wouldn't you just use ZFS everywhere if it's safer? Because the RAM overhead is real money and complexity at scale. If every general-purpose server needs extra memory just for the filesystem, that cost adds up fast across a fleet, and most workloads don't need its snapshot or integrity features.
When would XFS be the wrong choice? For workloads dominated by many small files rather than large ones, since XFS is optimized for large file throughput, not that access pattern.
What would push you toward ZFS despite the cost? A workload where data integrity guarantees and snapshotting are non-negotiable, like certain storage-heavy or compliance-driven systems, where the RAM cost is worth paying.
The common wrong answer
The typical mistake is picking one filesystem as a blanket answer, usually "ext4, because it's standard" or "ZFS, because it's the most advanced," without mentioning the resource tradeoffs. Candidates who skip the RAM cost of ZFS or the file-size sweet spot of XFS sound like they've read a comparison chart but never had to size a real server.
Prefer it spoken? Watch the 30-second answer on YouTube