Friday, July 4, 2014

SSD tweaks under Ubuntu 14.04 LTS Server

Change IO Scheduler

"The scheduler helps organise reads and writes in the I/O queue to maximise performance. The default scheduler in the Linux kernel is CFQ (Completely Fair Queuing) which is designed with the rotational latencies of spinning platter drives in mind. So while it works well for standard hard drives it doesn’t work so well when it comes to SSDs." — http://apcmag.com/how-to-maximise-ssd-performance-with-linux.htm

Edit /etc/default/grub and add elevator=deadline to GRUB_CMDLINE_LINUX_DEFAULT:

#GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX_DEFAULT="elevator=deadline"

Update GRUB settings with update-grub2:

root@localhost:~# update-grub2
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-30-generic
Found initrd image: /boot/initrd.img-3.13.0-30-generic
Found linux image: /boot/vmlinuz-3.13.0-24-generic
Found initrd image: /boot/initrd.img-3.13.0-24-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done

Verify deadline scheduler is in use:

root@localhost:~# cat /sys/block/sda/queue/scheduler 
noop [deadline] cfq 

/etc/fstab options

Add discard,noatime, and nodiratime options to all partitions on the SSD in the /etc/fstab file.

Descriptions of the options found in the mount man page:

discard/nodiscard
              Controls  whether ext4 should issue discard/TRIM commands to the underlying block device
              when blocks are freed.  This is useful for  SSD  devices  and  sparse/thinly-provisioned
              LUNs, but it is off by default until sufficient testing has been done.

noatime
              Do not update inode access times on this filesystem (e.g., for faster access on the news
              spool to speed up news servers).

nodiratime
              Do not update directory inode access times on this filesystem.

Backup /etc/fstab first:

root@localhost:~# cp -v /etc/fstab{,.bak}
‘/etc/fstab’ -> ‘/etc/fstab.bak’

Edit and add options in /etc/fstab:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/vg0-lv_root /       ext4    errors=remount-ro,discard,noatime,nodiratime    0       1

References

http://www.howtogeek.com/62761/how-to-tweak-your-ssd-in-ubuntu-for-better-performance/
http://apcmag.com/how-to-maximise-ssd-performance-with-linux.htm

No comments:

Post a Comment