The filesystem you choose for your VPS has a measurable impact on application performance, particularly for database and file-serving workloads. While ext4 is the default on most Linux distributions, XFS and Btrfs offer distinct advantages for specific use cases. This article benchmarks all three filesystems on a typical VPS configuration and provides mkfs and mount optimization flags for each workload type.
Filesystem Overview
| Filesystem | Maturity | Max Volume | Max File | Features |
|---|---|---|---|---|
| ext4 | Stable (2008) | 1 EB | 16 TB | Journaling, extents, delayed allocation |
| XFS | Stable (1994) | 8 EB | 8 EB | Scalable parallel I/O, online defrag, reflink/dedupe |
| Btrfs | Stable (2024+) | 16 EB | 16 EB | Copy-on-write, snapshots, compression, RAID |
Benchmark Methodology
All benchmarks were run on a 4 vCPU, 8 GB RAM VPS with NVMe storage. Each filesystem was tested with identical hardware using fio for database-simulated workloads (random 8K/16K I/O) and web-simulated workloads (mixed small-file reads and writes). Results are averaged over three runs each.
Database Workload Results (8K Random Read/Write)
| Filesystem | Random Read (IOPS) | Random Write (IOPS) | Latency (ms) |
|---|---|---|---|
| ext4 (default) | 38,200 | 12,400 | 0.62 |
| ext4 (optimized) | 41,800 | 14,100 | 0.54 |
| XFS (default) | 39,100 | 13,200 | 0.59 |
| XFS (optimized) | 44,300 | 15,800 | 0.48 |
| Btrfs (default) | 31,400 | 9,800 | 0.89 |
| Btrfs (no CoW) | 37,600 | 12,100 | 0.66 |
XFS delivers the best database performance — up to 15% more IOPS than default ext4 and 40% more than default Btrfs. Btrfs copy-on-write overhead is significant for random write workloads; disabling CoW on database directories recovers most of the gap.
Web Server Workload Results (Mixed Small Files)
| Filesystem | Small File Read (IOPS) | Small File Write (IOPS) | Directory Create (ops/s) |
|---|---|---|---|
| ext4 | 22,500 | 8,300 | 5,200 |
| XFS | 23,100 | 8,700 | 4,100 |
| Btrfs (no CoW) | 21,800 | 7,900 | 6,800 |
For web server workloads with many small files (static assets, cached pages), ext4 and XFS are nearly equivalent. Btrfs excels at directory operations, making it a strong choice for content-heavy sites with frequent file creation and deletion.
Optimized mkfs and Mount Options
Use these formatting and mount options for each filesystem based on your workload:
For Database Workloads (PostgreSQL, MySQL)
# ext4
mkfs.ext4 -O ^has_journal -E lazy_itable_init=0,lazy_journal_init=0 /dev/vdb1
mount -o noatime,nodiratime,nobarrier,data=ordered /dev/vdb1 /var/lib/postgresql
# XFS (Recommended for databases)
mkfs.xfs -f -m reflink=0 -d agcount=4 -l size=128m -n size=8192 /dev/vdb1
mount -o noatime,nodiratime,nobarrier,allocsize=1m,largeio,inode64 /dev/vdb1 /var/lib/postgresql
# Btrfs
mkfs.btrfs -f -m single -d single /dev/vdb1
mount -o noatime,nodiratime,nospace_cache,autodefrag /dev/vdb1 /var/lib/postgresql
# Disable CoW on database directories:
chattr +C /var/lib/postgresql
For Web Server Workloads (Nginx static files, caches)
# ext4 (Recommended for web serving)
mkfs.ext4 -O ^has_journal -E lazy_itable_init=0 /dev/vdb1
mount -o noatime,nodiratime,data=writeback /dev/vdb1 /var/www
# XFS
mkfs.xfs -f -m reflink=0 -d agcount=4 /dev/vdb1
mount -o noatime,nodiratime,allocsize=256k /dev/vdb1 /var/www
# Btrfs (Best for cache with many small files)
mkfs.btrfs -f -m single -d single /dev/vdb1
mount -o noatime,nodiratime,compress=zstd:1,autodefrag /dev/vdb1 /var/www
The noatime and nodiratime options are critical on all filesystems — they eliminate write operations on every file read, which can reduce disk I/O by 30–50% on heavily accessed servers. See why our VPS benchmarks matter for real-world latency data across different storage configurations.
When to Choose Each Filesystem
- ext4 – Best all-around choice for most VPS users. Simple, battle-tested, and performs well across database and web workloads. Use it unless you have a specific reason to switch.
- XFS – Superior for database workloads, especially with concurrent connections. Its allocation groups reduce contention under parallel writes. Ideal for PostgreSQL or MySQL on multi-core VPS instances.
- Btrfs – Choose Btrfs when you need snapshots for backup or ZSTD compression to save disk space on storage-constrained VPS plans. Disable CoW on database directories to avoid the write performance penalty.
Verifying Filesystem Performance
After formatting and mounting, benchmark your chosen configuration:
# Check mount options
mount | grep /dev/vdb
# Database workload test
fio --name=db-test --ioengine=libaio --direct=1 --bs=8k --iodepth=32 --size=2G --rw=randrw --rwmixread=70 --runtime=60 --group_reporting
# Check if noatime is applied
cat /proc/mounts | grep "/dev/vdb"
Conclusion
Filesystem choice has a measurable impact on VPS performance — up to 15–20% IOPS difference between default configurations and optimized setups. For general use, ext4 with noatime is the safe default. For database-heavy workloads, XFS with tuned allocation groups delivers the highest throughput. For VPS instances where backups or compression matter most, Btrfs with discretionary CoW is a strong contender. Whichever filesystem you choose, applying the optimized mkfs and mount flags can unlock significant performance without changing your hardware. Compare VPS providers on our comparison table to find hosts that let you customize your storage configuration.


Leave a Reply
You must be logged in to post a comment.