#1
THIS FIRST SECTION APPLIES TO ANYONE WITH OR WITHOUT AN SSD
To improve performance:
Limiting Writes on the drive by moving non-essential directories to RAM
Edit /etc/fstab with your CLI text editor, IE nano or similar (requires sudo invocation IIRC)
Go to the end of /etc/fstab and add this (you can copy and paste just remember past inside a terminal windows is Ctrl+SHIFT+V)
Code:
Code:
[CODE]# Move the user cache to RAM
tmpfs /home/USERNAME/.cache tmpfs defaults,noatime,nosuid 0 0
[/CODE]
Make sure you understand that /home/USERNAME means the home directory of YOUR user thus if you created a user named Bob you need to change USERNAME to Bob (case matters) /home/Bob/.cache

This only works for directories that are temporary in nature so it will not work for libs, bin, or share and would make an unbootable system if you tried to move them to tmpfs.

It will also not work if you have encrypted your drive & "/" mount point using ecryptfs.

#1.2
FURTHER FSTAB TWEAKS WORTH DOING
Don’t forget to add noatime to /etc/fstab for each SSD you have a Linux install/filesystem on to limit writes

#2
THE SWAP, CACHE, AND TWEAK SECTION FOR BOTH SSDs AND HDDs
This section deals with a setup that has no swap and is recommended mainly for systems with 4GB+ of RAM
First;
edit /etc/sysctl.conf as sudo
Code:
Code:
[CODE]sudo nano /etc/sysctl.conf
[/CODE]
and add
Code:
Code:
[CODE]vm.swappiness=0 
vm.vfs_cache_pressure=90
[/CODE]
to the end of it.
The higher value for pressure the more it will favor program data in caches and the lower the more it will favor files; thus 50 will split preference between the two. The default should be about 60.
#2.1
If you want swap without it being on the SSD (also useful for HDDs if you have less than 4GB of RAM) then there is Zram which trades some CPU usage for creating a swap in RAM setup. DO NOT USE if you have another location for swap setup, IE you let the Ubuntu/Mint installer set up your drives.
First
Code:
Code:
[CODE]sudo apt-get install zram-config
[/CODE]
(this is the Ubuntu name and method; I don't know the name for other distros)
It should help on reboot using your ram for a compressed swap device as some things are just picky about swap. Remember to adjust the vm.swappiness amount from the previous section to something higher than 0 if you install/enable zram. Generally, vm.swappiness=20 should be the max but it depends on your choice.

#3
For SSDs only:
First, most distros should automatically setup to use either the deadline or noop scheduler when installing on an SSD. So you should check first.
Code:
Code:
[CODE]cat /sys/block/sda/queue/scheduler
[/CODE]
Whatever is in brackets will be the one in use so example
Code:
Code:
[CODE]noop [deadline] cfq
[/CODE]
If it isn't deadline or noop then you should do the following:
To change data access scheduler for drives install “sysfsutils”. (Need name of package for non-buntu distros)
Code:
Code:
[CODE]sudo apt-get install sysfsutil
[/CODE]
Next, is done assuming the SSD is on “sda”
If you have several disks or a mix of SSD and mechanical disks, install the sysfsutils package and add the following line at the end of /etc/sysfs.conf:
Code:
Code:
[CODE]block/sda/queue/scheduler = noop
[/CODE]
*or for deadline [ block/sda/queue/sheduler=deadline ]*
Then you can check on reboot what scheduler is in use:
Code:
Code:
[CODE]cat /sys/block/sda/queue/scheduler
[/CODE]
whatever is in brackets will be the one in use so example
Code:
Code:
[CODE]noop [deadline] cfq
[/CODE]
#3.1
The TRIM issue: About discard vs fstrim; assuming an ext4 based filesystem
IT SHOULD BE NOTED THAT AS OF K/X/L/UBUNTU 14.04 TRIM SHOULD BE HANDLED THROUGH A DAILY AUTOMATED CRON JOB AND YOU WILL NOT HAVE TO DO THE FOLLOW STEPS. HOWEVER, IF YOU WANT TO CHANGE/CHECK THINGS OR THIS CHANGE DOES NOT GET ACCEPTED IN THE 14.04 RELEASE THEN READ ON.
UPDATED as of Ubuntu 14.04 the automatic cron job for fstrim is only enabled for Intel or Samsung drives for "safety" reasons. If you wish to use trim on another brand drive you will have to do it yourself as shown here.
Currently it is recommended to avoid using the discard option through /etc/fstab and instead use the fstrim (which works any etx4,btrfs, and f2fs) command from terminal/CLI
Here is an example of fstrim:
Code:
Code:
[CODE]sudo fstrim / -v
[/CODE]
This however is only if you have one partition on the ssd and everything is inside /
The command will take a while and it will not report anything until it has completed so be patient. (Time ranges depend on the size of the partition being trimmed).