Fri, November 30, 2018 ยท 2 min read

Optimizing disk i/o speeds and lifespan of ssd on fedora(29)

Optimizing disk i/o speeds and lifespan of ssd on fedora(29)

In this case I am using a ssd drive named /dev/sdb with filesystem formatted to ext4. It is known that ssd has limited write cycles and eventually wears off overtime compared to normal HDD but ssd has a greater speed advantage.

Checking ssd current state with smartctl:

smartctl -data -A /dev/sdb

Look out for Media_Wearout_Indicator to see how healthy the drive is. A value of below 10 should be when we should consider replacing the drive.

To decrease number of writes to the disk we can use the noatime flag to fstab, this would eliminate writing time stamps to disk for read files:

UUID=8ab5debd-b855-4bef-a242-5f8c77eaa0ef / ext4 noatime,discard,errors=remount-ro 1 1

Temporary filesystem /tmp can be mounted to decrease writes on hdd:

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0

Tweaking swappiness value. By default in linux swappiness value is set to 60. For better performance on my laptop I will be going with swappiness value of 10:

sysctl -w vm.swappiness=10

Setting i/o scheduler to deadline for running host as a kvm-host server:

echo 'deadline' > /sys/block/sda/queue/scheduler

To make changes persistent, add elevator=deadline to grub configuration:

GRUB_CMDLINE_LINUX="resume=UUID=ed7c65c3-2d8d-45de-8a70-0ed1122f16eb video=SVIDEO-1:d rhgb quiet console=tty0 console=ttyS0,115200n8 elevator=deadline transparent_hugepage=never"

Generate grub file:

grub2-mkconfig -o /boot/grub2/grub.cfg