How to Optimize SSD Performance on Arch Linux
Categories:
5 minute read
Solid State Drives (SSDs) offer significant performance improvements over traditional spinning hard drives, particularly in terms of data access speed and boot times. However, to truly get the best performance and longevity from your SSD on Arch Linux, it’s essential to apply specific optimizations. Unlike some operating systems that automatically apply SSD-friendly configurations, Arch Linux assumes the user will manually handle system optimization.
In this guide, we’ll cover the most effective and safe ways to optimize SSD performance on Arch Linux, including filesystem choices, TRIM configuration, I/O schedulers, mount options, and additional system tweaks.
1. Check If You’re Using an SSD
Before proceeding with optimizations, let’s confirm that your drive is actually an SSD. Run the following command to identify your storage device:
lsblk -d -o name,rota
This shows all block devices and whether they have rotational parts (ROTA=1
for HDDs, ROTA=0
for SSDs). If your drive has ROTA=0
, it’s a non-rotational (SSD) device.
Alternatively, you can use:
cat /sys/block/sdX/queue/rotational
Replace sdX
with your drive identifier (e.g., sda
or nvme0n1
). A return value of 0
confirms it’s an SSD.
2. Filesystem Choices and Configuration
The choice of filesystem can influence SSD performance and lifespan. Here are the best options for SSDs:
ext4
The most widely used Linux filesystem, ext4 is stable and fast, especially with the right mount options.
Recommended Mount Options for SSD
noatime
: Prevents frequent writes when reading files.discard
: Enables continuous TRIM operations.defaults
: Standard recommended settings.
Example fstab entry:
UUID=xxxx-xxxx / ext4 defaults,noatime,discard 0 1
Note: While
discard
enables real-time TRIM, some users preferfstrim.timer
(see Section 3) due to potential performance overhead.
Btrfs
Btrfs is a modern copy-on-write filesystem that includes native support for snapshots, compression, and SSD optimizations.
Mount with:
mount -o noatime,compress=zstd,ssd,space_cache=v2 /dev/sdXn /mnt
Use ssd
or ssd_spread
mount option to notify Btrfs it’s operating on an SSD.
3. Enable Periodic TRIM
TRIM helps the SSD controller manage unused data blocks, ensuring better write performance and longevity.
Instead of using the discard
mount option, which performs TRIM operations in real-time (and can affect performance under load), many users prefer enabling the fstrim.timer
systemd service for weekly TRIM.
Enable TRIM Timer
sudo systemctl enable fstrim.timer
sudo systemctl start fstrim.timer
This will run /usr/bin/fstrim -av
once a week, trimming all mounted file systems that support it.
You can check the status and last run time with:
systemctl status fstrim.timer
4. Select an Optimal I/O Scheduler
SSDs don’t benefit from traditional I/O scheduling as HDDs do. Arch Linux often defaults to the best scheduler, but it’s worth checking.
Check Current Scheduler
cat /sys/block/sdX/queue/scheduler
You’ll see a list of schedulers, with the active one in brackets, e.g.:
[mq-deadline] kyber bfq none
Recommended Schedulers for SSDs
none
ormq-deadline
: Best for modern SSDs with NVMe or SATA interfaces.kyber
: Suitable for high-performance SSDs under server workloads.
Set Default Scheduler
To make your choice persistent, create a udev rule:
sudo nano /etc/udev/rules.d/60-ioschedulers.rules
Insert the following:
# Set scheduler for non-rotational (SSD) devices
ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}="none"
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline"
Reload udev rules:
sudo udevadm control --reload
5. Tweak Swap Behavior
While swap is still used with SSDs, unnecessary swapping can reduce performance and wear out your SSD faster.
Adjust Swappiness
Check current swappiness (default is 60):
cat /proc/sys/vm/swappiness
Lower it to reduce the kernel’s tendency to use swap:
sudo sysctl vm.swappiness=10
To make it permanent:
echo 'vm.swappiness=10' | sudo tee /etc/sysctl.d/99-swappiness.conf
Use zram (Optional)
Instead of writing to disk-based swap, zram compresses memory into RAM, which is faster and reduces SSD writes.
Install and enable:
sudo pacman -S zram-generator
Then create a config file like:
# /etc/systemd/zram-generator.conf
[zram0]
zram-size = ram / 2
compression-algorithm = zstd
Enable it with:
sudo systemctl daemon-reexec
sudo systemctl start /dev/zram0
6. Enable Systemd Journal in RAM (Optional)
The systemd journal writes logs frequently. You can store these in RAM to avoid frequent SSD writes.
Configure Volatile Logging
Edit:
sudo nano /etc/systemd/journald.conf
Set:
Storage=volatile
This makes logs stored in /run/log/journal
, which is tmpfs (RAM-based). Keep in mind: logs will not persist across reboots.
7. Use tmpfs for /tmp and other directories
To reduce unnecessary disk writes, you can mount /tmp
in RAM.
Add this to your /etc/fstab
:
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
You can also use tmpfs for browser caches, build directories, or custom paths like:
tmpfs /home/youruser/.cache tmpfs defaults,noatime,mode=0755,size=1G 0 0
8. Check and Monitor SSD Health
Install smartmontools
to monitor drive health:
sudo pacman -S smartmontools
Check health with:
sudo smartctl -a /dev/sdX
For NVMe drives:
sudo smartctl -a /dev/nvme0
Watch for metrics like wear level, reallocated sectors, and temperature.
9. Disable Access Time Updates (Relatime Optimization)
If noatime
is not an option (because some applications need access time), use relatime
instead, which is more conservative.
Most Arch Linux systems already default to relatime
, but you can ensure it in /etc/fstab
:
UUID=xxxx-xxxx / ext4 defaults,relatime 0 1
10. Keep Your Firmware Up to Date
Occasionally, SSD manufacturers release firmware updates to fix bugs and improve performance.
Use the fwupd
utility:
sudo pacman -S fwupd
sudo fwupdmgr refresh
sudo fwupdmgr get-updates
sudo fwupdmgr update
Note: Not all SSDs support Linux firmware updates.
Conclusion
Optimizing SSD performance on Arch Linux isn’t just about speed—it’s about ensuring longevity and reliability too. With just a few simple but effective tweaks, you can enhance both the responsiveness and the health of your SSD.
To summarize:
- Use the right filesystem and mount options (e.g.,
noatime
,discard
, orfstrim.timer
). - Enable weekly TRIM with
fstrim.timer
. - Choose a suitable I/O scheduler (
none
ormq-deadline
). - Tweak swap behavior with
swappiness
orzram
. - Store logs and temporary files in RAM (
tmpfs
,volatile
journal). - Monitor SSD health using
smartctl
. - Keep firmware updated via
fwupd
.
Arch Linux gives you the flexibility and control to finely tune your system. With these SSD optimizations in place, you’ll enjoy a faster, more efficient, and longer-lasting Linux experience.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.