SSD Tuning for Fedora 21


+--------------------------------------
| Based on

  https://ask.fedoraproject.org/en/question/41664/optimization-for-an-ssd/
  https://wiki.debian.org/SSDOptimization
  http://blog.neutrino.es/2013/howto-properly-activate-trim-for-your-ssd-on-linux-fstrim-lvm-and-dmcrypt/
  https://bugzilla.redhat.com/show_bug.cgi?id=890533
  ... and several others.


+--------------------------------------
| TRIM activating (LUKS, LVM, EXT4)



1. LUKS -> /etc/crypttab AND/OR /etc/default/grub

	vi /etc/default/grub
		GRUB_CMDLINE_LINUX="... 	rd.luks.options=discard"
	grub2-mkconfig -o /boot/grub2/grub.cfg
	vi /etc/crypttab
		luks-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx none allow-discards

2. LVM -> /etc/lvm/lvm.conf

	vi /etc/lvm/lvm.conf
		issue_discards = 1

3. EXT4 -> /etc/fstab

	vi /etc/fstab
		/dev/mapper/fedora_pc-root /                       ext4    discard,defaults,x-systemd.device-timeout=0 1 1
		UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx /boot     ext4    defaults        1 2
		/dev/mapper/fedora_pc-home /home                   ext4    discard,defaults,x-systemd.device-timeout=0 1 2
		/dev/mapper/fedora_pc-swap swap                    swap    discard,defaults,x-systemd.device-timeout=0 0 0

4. INITRAMFS

	dracut -f

5. Swappiness

	cat /proc/sys/vm/swappiness
		60 - default
	vi /etc/sysctl.conf
		vm.swappiness = 20 (10 - 30 by size of RAM)

6. Low-Latency IO-Scheduler

	cat /sys/block/sda/queue/rotational
		1 for HDD
		0 for SSD

	cat /sys/block/sda/queue/scheduler
		noop deadline [cfq] - for HDD

	yum install sysfsutils
	echo "block.sda.queue.scheduler = deadline" >> /etc/sysfs.conf 

7. Reboot

8. Low-Latency IO-Scheduler

	cat /sys/block/sda/queue/scheduler
		noop [deadline] cfq - for SSD

9. FSTrim

	vi trim.sh
		#!/bin/sh
		LOG=/root/fstrim.log
		set -e
		echo "*** $(date -R) ***" >> $LOG
		/sbin/fstrim -v / >>$LOG
		/sbin/fstrim -v /home >>$LOG
	chmod +x trim.sh
	./trim.sh
		OR
	mv trim.sh /etc/cron.weekly/


+--------------------------------------
| Miscellaneous tuning


1. /tmp -> RAM

	vi /etc/fstab
		tmpfs /tmp tmpfs defaults,noatime,mode=1777,size=20% 0 0

2. Firefox cache

	about:config
	browser.cache.disk.enable		false
	browser.cache.memory.enable		true
	#browser.cache.memory.capacity		-1

		OR

	about:config
	browser.cache.disk.parent_directory		/dev/shm/firefox