SSDs are available for some time now. I had to replace my good old desktop with a newer one because the motherboard started to fail intermittently. I decided to include a 120GB SSD in my new system and spent some time to find out what I have to do in order to increase the lifetime of my SSD. SSDs deliver data very fast on read. On write it takes longer and unfortunately the number of writes is limited. That's why the number or writes to the SSD should be reduced as far as it is possible. On the following pages I describe in detail which changes I did on my Linux Mint 13 and they should also apply on other Linux distributions.

 

First of all I formatted the partition and reserved some unused space (overprovisioning). Then I installed the whole operating system on the SDD drive and  later on moved portions of the filesystem on my hdd. Some filesystems heavily written on I moved into RAM (I have about (GB RAM available). Then I modified the /etc/fstab and some system settings and finally updated some firefox settings. Note I didn't put the swap partition on the SDD.

SSD formatting

It's suggested to allocate only 90% of the SSD disk and leave 10% free. 

Partitions moved to hdd

First of all I thought I should keep my /home directory on SSD, but I decided to move it on hdd.

Partitions moved to tmpfs (RAM)

/tmp, /var/spool, /vartmp and /var/log are moved into RAM. There is one drawback for /var/log: The log doesn't surviwe reboots. If there are any problems of system freeze to track down /var/log has to be put on disk.

My fstab has following entries for tmpfs

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

 Changes in /etc/fstab

noatime in /etc/fstab disables the write action "access time stamp", that the operating system puts on a file whenever it's being read by the operating system. For an SSD "noatime" is much better. SO now my /etc/fstab entry for my SSD is

UUID=cc4a6c12-5ec6-4243-993f-8dcbbf15da71 /               ext4    noatime,commit=600,errors=remount-ro 0       1

System config changes

trim should be used to keep the good performance of SSD drives. In addition the scheduler should be modified for the SSD to use another strategy. I added following lines to my /etc/rc.local (Note: My SSD is /dev/sda)

# ssd trim
fstrim -v /
# ssd scheduler
echo "deadline" > /sys/block/sda/queue/scheduler
# Modification for SSD which creates log files on /var/log
for dir in apparmor apt cups dist-upgrade fsck gdm installer samba unattended-upgrades; do
if [ ! -e /var/log/$dir ] ; then
  mkdir /var/log/$dir
  fi
done

Update firefox settings

In about:config I modified following settings:
1. browser.cache.disk.enable set to false
2. browser.cache.memory.enable set to true
3. New browser.cache.memory.capacity set to -1

Monitor SSD usage

See this link for details how to check the usage of your SDD drive. It's also useful to use atop or iostats to monitor the SSD usage. Another command to use is

pidstat -dl 20

References

A good ssd/hdd partition scheme

How to maximize ssd performance with Linux

Solid State Drive (SSD): optimize it for Ubuntu 14.04, Linux Mint and Debian

SSD Optimization - Debian Wiki

Investigate disk writes further to find out which process writes to my SSD

SSD owners: Set Firefox to memory cache instead of disk

Tunings an SSD on LInux

Understandin SSD Overprovisioning

SSD Unter Linux optimieren

Installing Linux on SSD

Add comment
Note
eMail is hidden and not visible to the public. It's used to inform you about new comments.