Skip to content

Instantly share code, notes, and snippets.

@trungnt13
Last active January 22, 2024 01:33
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save trungnt13/d6632130c43db424d56f0d30247033ec to your computer and use it in GitHub Desktop.
Save trungnt13/d6632130c43db424d56f0d30247033ec to your computer and use it in GitHub Desktop.
Optimize performance for SSD (NVMe) on Linux
sudo cp /etc/fstab /etc/fstab.bak
# Eschewing Access Times
sudo nano /etc/fstab
# add this options, make sure they’re all separated by commas and no spaces.
noatime,nodiratime
# example: UUID=uuid_number / ext4 defaults,noatime,discard,errors=remount-ro 0 1A
# TRIM Fit
discard
# Add to kernel boot parameters
sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset scsi_mod.use_blk_mq=1"
sudo update-grub2
# Benchmark
sudo hdparm -tT --direct /dev/nvme0n1
@bepcyc
Copy link

bepcyc commented Aug 25, 2017

You don't need a nodiratime here.
From man mount:
noatime
Do not update inode access times on this filesystem (e.g., for faster access on the news spool to speed up news servers). This works for all inode types (directories too), so implies nodiratime.

@attila123
Copy link

Note: discard is discouraged for NVMe drives!
See https://wiki.archlinux.org/index.php/Solid_State_Drive/NVMe
"NVMe devices should not be issued discards."

@diododias
Copy link

you can add barrier=0 to fstab parameters, with docker applications increase substantially the io and reduce latency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment