SSD with ext4 optimisation

Post with image

The performance of SSDs is also influenced by filesystem mounting options
Enable the „discard” filesystem options for automatic online TRIM.
To enable weekly trim we will use a service timer:

sudo cp /usr/share/doc/util-linux/examples/fstrim.{service,timer} /etc/systemd/system
sudo systemctl enable fstrim.timer

After changing filesystem options, update settings in all initramfs images:

sudo update-initramfs -u -k all

Add the „noatime” (or „relatime”) mount option in /etc/fstab, to disable (or significantly reduce) disk writes whenever a file is read. Please note that since Linux kernel 2.6.30, „relatime” is the default. This improves filesystem read performance for both SSDs and HDDs.

here is an example of an fstab file:

# /etc/fstab: static file system information.
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point> <type> <options> <dump> <pass>
### SSD: discard,noatime
### match battery operation default for commit JOURNAL_COMMIT_TIME_AC in Add files in /etc/pm/config.d/*
/dev/mapper/goofy-root / ext4 discard,noatime,commit=600,errors=remount-ro 0 1
# /boot was on /dev/sda1 during installation
UUID=709cbe4a-80c1-46cb-8bb1-dbce3059d1f7 /boot ext4 discard,noatime,commit=600,defaults 0 2
### SSD: discard
/dev/mapper/goofy-swap none swap sw,discard 0 0
/dev/mapper/goofy-chroot /srv/chroot btrfs ssd,discard,noatime 0 2
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0 


Also for ssd reduce swap usage:



Leave a reply

Your email adress will not be published. Required fields are marked*