Differences between revisions 1 and 87 (spanning 86 versions)
Revision 1 as of 2011-11-23 15:03:49
Size: 3322
Editor: OsamuAoki
Comment:
Revision 87 as of 2014-12-10 17:17:12
Size: 13476
Comment: add link
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from SSDoptimization
Line 5: Line 6:
This describe SDD optimization with system having encrypted root and swap.

## If your page gets really long, uncomment this Table of Contents
This page is about optimal set up of an SSD (Solid State Drive). This page should be kept clean enough for beginners to get the most basic idea.
Line 10: Line 10:
== SSD Optimization on the powerful laptop PC ==

For a PC with 256GB SSD with system having encrypted root and swap, system is mounted as:

{{{
$ mount
/dev/mapper/crypto-root on / type ext4 (rw,noatime,discard,commit=600,errors=remount-ro,commit=600)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,size=5242880,mode=755,size=5242880,mode=755)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=755,size=10%,mode=755)
tmpfs on /tmp type tmpfs (rw,noexec,nosuid,nodev,noatime,mode=1777,size=20%,mode=1777,mode=1777)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,size=20%,mode=1777,size=20%,mode=1777)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620,gid=5,mode=620)
/dev/sda1 on /boot type ext4 (rw,noatime,discard,commit=600,commit=600)
tmpfs on /var/log type tmpfs (rw,noexec,nosuid,nodev,noatime,mode=1777)
tmpfs on /home/username/.cache type tmpfs (rw,noexec,nosuid,nodev,noatime,uid=1000,gid=1000,mode=700)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
}}}

This is done with the foloowings.

/etc/fstab:
== Basics ==

 * Use a reasonably recent Linux kernel (at least 3.2 or newer).
   * SSD caching is only supported on Linux 3.9 or newer.
 * Use the latest firmware for the SSD
   * Use a command like: "{{{sudo smartctl -a /dev/sda}}}" to check for issues.
   * Update firmware as needed.
 * Use the ext4 filesytem (the most mature filesystem) unless you have reason not to.
   * The btrfs filesytem is still in experimental state (as of kernel 3.11) but supports additional mount options like "ssd".
 * Have enough DRAM required to operate without swap space under normal workloads.
   * You need a swap partition that is larger than your DRAM to save all the DRAM content securely for hibernation.
   * If your SSD size is too small for your DRAM size, think about placing your swap on the larger classic HDD.
   * If you are planning on doing a huge amount of writes (more than 40-50 GB per day), it is advised to avoid SSDs that use TLC NAND.


These may also help:
 * https://wiki.archlinux.org/index.php/SSD
 * http://siduction.org/index.php?module=news&func=display&sid=78
 * http://forums.debian.net/viewtopic.php?f=16&t=76921
 * http://wiki.ubuntuusers.de/SSD (German)

== Partitions and Alignment ==

You should consider to use the [[Multi HDD/SSD Partition Scheme]] to keep variable and bulk data on the HDD(s) and establish a fallback redundancy, if the system also has a HDD available (internal or external spinning disk).

Since Wheezy, all tools should automatically align filesystems and partitions to the 4096 byte page size. This is one of the most important optimization aspects. Here are good links for this subject:

 * [[http://en.wikipedia.org/wiki/Advanced_format|Advanced Format]]
 * [[http://www.linux-mag.com/id/8397/|Aligning SSD Partitions (Linux magazine)]]
 * [[http://tytso.livejournal.com/2009/02/20/|Aligning filesystems to an SSD’s erase block size] by Ted T'so]] (kernel FS developer)
 * http://blog.nuclex-games.com/2009/12/aligning-an-ssd-on-linux/
 * http://lifehacker.com/5837769/make-sure-your-partitions-are-correctly-aligned-for-optimal-solid-state-drive-performance

== Mounting SSD filesystems ==

The performance of SSDs is also influenced by filesystem mounting options:

 * Add the "noatime" (or "relatime") mount option in /etc/fstab, to disable (or significantly reduce) disk writes whenever a file is read.
  * This improves filesystem read performance for both SSDs and HDDs.
 * '''If desirable''', enable the "discard" filesystem options for automatic/online TRIM.
  * Set "discard" mount option in /etc/fstab for the ext4 filesystem, swap partition, Btrfs, etc. See mount(8).
  * Set "issue_discards" option in /etc/lvm/lvm.conf for LVM. See lvm.conf(5).
  * Set "discard" option in /etc/crypttab for dm-crypt.
 * The "discard" options '''is not needed''' if your SSD has enough overprovisioning (spare space) or you leave (unpartitioned) free space on the SSD.
  * See http://www.spinics.net/lists/raid/msg40866.html
 * The "discard" options with on-disk-cryptography (like dm-crypt) have '''drawbacks with security/cryptography'''.
  * See [[http://manpages.debian.org/cgi-bin/man.cgi?query=crypttab&apropos=0&sektion=0&manpath=Debian+unstable+sid&format=html&locale=en|crypttab(5)]].

Example for dm-crypt's /etc/crypttab:
{{{
#<target name> <source device> <key file> <options>
var UUID=01234567-89ab-cdef-0123-456789abcdef none luks,discard
}}}

After changing filesystem options, update settings in all initramfs images:
{{{
$ sudo update-initramfs -u -k all
}}}

(!) Alternative to setting the "discard" options is to set up an offline-trim cronjob that runs {{{time fstrim -v }}} (or mdtrim) on the ssd mountpoints periodically. Until software raid (md device layer) has trim support, you could use something like mdtrim (https://github.com/Cyberax/mdtrim/).

== Reduction of SSD write frequency via RAMDISK ==

Use of RAMDISK can stop constantly changing files from hitting on the SSD (it may hit SSD via swap). RAMDISK configuration may be performed via

 * Set RAMTMP, RAMRUN and RAMLOCK to "yes" (in /etc/default/rcS or /etc/default/tmpfs since wheezy)
 * /etc/fstab: line such as "tmpfs /tmp tmpfs noatime,nosuid 0 0"
 * Optionally, make system only flush data to the disk every 10 minutes or more:
  * Kernel settings like the "dirty_buffer_ratio" etc. may only be available as non-path/mount specific global settings.
  * Mount option "commit=600" in /etc/fstab. See mount(8).
  * Or better, use pm-utils ([[DebianBug:659260|Debian BTS #659260]]), tlp, or laptop-mode-tools (also optimizes read buffers) to configure the laptop-mode even under AC operation.

 /!\ Attention: Increasing the flushing interval from the default 5 seconds (maybe even until proper shutdown) leaves your data much more vulnerable in case of lock-ups or power failures, and seems to be a global setting.

Enabling RAMTMP may cause some (broken) applications to run out of temporary write disk space. Setting TMPDIR environment variable for those programs pointing to a writable disk space should fix their situation.

Please note files in /tmp are wiped out upon reboot unless /etc/default/rcS is set to something other than TMPTIME=0 (if not set, 0 is the default value).

== Persistent RAMDISK ==

As an advanced option, you may consider to use persistent RAMDISK (dedicated read/write RAM buffer that gets synced periodically and on startup/shutdown) with anything-sync-daemon or goanysync set up:

 * /home (synced to work-data-fs raid only once a day?), you only risk settings the true work in /home/*/work-data is on a dedicated raid
 * /home/*/work-data/volatile (synced more frequently, once per hour?)
 * /home/*/Downloads (synced to bulk-data-fs once a day?)
 * /var completely if supported (syncing once a day? avoids spin-ups and allows to save /var also to SSD), at least set this up for
  * /var/log if supported
  * /var/cache/apt/archives
     Configure apt to delete package files after installing, to minimize the data to sync.

Options to having logs copied into RAM:
 * http://www.debian-administration.org/articles/661
 * http://www.tremende.com/ramlog
 * https://github.com/graysky2/anything-sync-daemon (if it supports this)
 * https://github.com/wor/goanysync

If /home is not on a persistent ramdisk, use profile-sync-daemon to have the browser database and cache copied into RAM during uptime (http://ubuntuforums.org/showthread.php?t=1921800 https://github.com/graysky2/profile-sync-daemon)
 * /home/*/<browser-cache-and-profiles> (synced to root-fs or home-fs)

Further improvement: Patch anything-sync-daemon or goanysync to use a (copy-on-write) union filesystem mount (e.g. http://aufs.sourceforge.net) to keep changes in RAM and only save to SSD on unmount/shutdown (aubrsync), instead of copying all data to RAM and having to sync it all back.

== Low-Latency IO-Scheduler ==

The default I/O scheduler queues data to minimize seeks on HDDs, which is not necessary for SSDs. Thus, use the deadline scheduler that just ensures bulk transactions won't slow down small transactions: Install sysfsutils and
  echo "block.sdX.queue.scheduler = deadline" >> /etc/sysfs.conf
(adjust sdX to match your SSD) reboot or
  echo deadline > /sys/block/sdX/queue/scheduler

In systems with different drive types you can adjust settings with a [[udev]] rule (create /etc/udev/rules.d/60-ssd-scheduler.rules):
{{{
# set deadline scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"
}}}

To check if the kernel knows about SSDs try:
{{{
  # for f in /sys/block/sd?/queue/rotational; do printf "$f is "; cat $f; done
/sys/block/sda/queue/rotational is 1
/sys/block/sdb/queue/rotational is 1
/sys/block/sdc/queue/rotational is 0 <=== Only this is SSD!
}}}
To switch scheduler manually issue:
{{{
# echo deadline > /sys/block/$YOURDRIVE/queue/scheduler
}}}
To see results:
{{{
# for f in /sys/block/sd?/queue/scheduler; do printf "$f is "; cat $f; done
/sys/block/sda/queue/scheduler is noop deadline [cfq]
/sys/block/sdb/queue/scheduler is noop deadline [cfq]
/sys/block/sdc/queue/scheduler is noop [deadline] cfq <== That is!
}}}

The dumb "noop" scheduler may be a little faster in benchmarks that max out the throughput, but this scheduler causes noticeable delays for other tasks while large file transfers are in progress.

== /etc/fstab example ==

Here is an example of /etc/fstab
Line 44: Line 157:
proc /proc proc defaults 0 0
Line 47: Line 159:
/dev/mapper/crypto-root / ext4 discard,noatime,commit=600,errors=remount-ro 0 1 /dev/mapper/goofy-root / ext4 discard,noatime,commit=600,errors=remount-ro 0 1
Line 49: Line 161:
UUID=709abe4b-81c1-96cb-8ac1-dace3159a1b7 /boot ext4 discard,noatime,commit=600,defaults 0 2 UUID=709cbe4a-80c1-46cb-8bb1-dbce3059d1f7 /boot ext4 discard,noatime,commit=600,defaults 0 2
Line 51: Line 163:
/dev/mapper/crypto-swap_1 none swap sw,discard 0 0 /dev/mapper/goofy-swap none swap sw,discard 0 0
/dev/mapper/goofy-chroot /srv/chroot btrfs ssd,discard,noatime 0 2
Line 53: Line 166:
### SSD OPTIMIZATION: /home/osamu/.cache on tmpfs
tmpfs /tmp tmpfs rw,noexec,nodev,nosuid,noatime,mode=1777 0 0
tmpfs /usr/tmp tmpfs rw,noexec,nodev,nosuid,noatime,mode=1777 0 0
tmpfs /var/log tmpfs rw,noexec,nodev,nosuid,noatime,mode=1777 0 0
tmpfs /home/osamu/.cache tmpfs rw,noexec,nodev,nosuid,noatime,uid=1000,gid=1000,mode=700 0 0
}}}

/etc/pm/config.d/SET_JOURNAL_COMMIT_TIME_AC
{{{
JOURNAL_COMMIT_TIME_AC=600
}}}
}}}


== /etc/lvm/lvm.conf example ==

{{{
...
# This section allows you to configure which block devices should
# be used by the LVM system.
devices {
...
    # Issue discards to a logical volumes's underlying physical volume(s) when
    # the logical volume is no longer using the physical volumes' space (e.g.
    # lvremove, lvreduce, etc). Discards inform the storage that a region is
    # no longer in use. Storage that supports discards advertise the protocol
    # specific way discards should be issued by the kernel (TRIM, UNMAP, or
    # WRITE SAME with UNMAP bit set). Not all storage will support or benefit
    # from discards but SSDs and thinly provisioned LUNs generally do. If set
    # to 1, discards will only be issued if both the storage and kernel provide
    # support.
    # 1 enables; 0 disables.
    #issue_discards = 0
    issue_discards = 1
}
...
}}}
Line 67: Line 196:
See

 * http://wiki.debian.org/DebianAcerOne?highlight=%28SSD%29#Reducing_Disk_Access_for_laptops_with_SSDs
 *
See

 * [[DebianAcerOne#Reducing_Disk_Access_for_laptops_with_SSDs|DebianAcerOne: "Reducing Disk Access for laptops with SSDs"]]


== Adding vm.swappiness in sysctl for the kernel ==

As per http://evolvisforge.blog.tarent.de/archives/68 which has come on p.d.o. as well as on 29/07/2013 the following needs to be added in /etc/sysctl.conf.d/ for better longevity of the disc:

{{{
# /etc/sysctl.d/local.conf

#vm.swappiness=0
vm.swappiness=1
}}}

Setting vm.swappiness=0 is more aggressive but may cause out-of-memory events. http://java.dzone.com/articles/OOM-relation-to-swappiness

'''Note:''' together with other settings vm.swappiness may be a considerable enhancement to I/O performance; worth reading: http://rudd-o.com/linux-and-free-software/tales-from-responsivenessland-why-linux-feels-slow-and-how-to-fix-that

== Upgrading the Firmware ==

Some problems might occur due to firmware bugs. Therefore, use tools like [[DebianPkg:smartmontools|smartctl]] (terminal) or [[DebianPkg:gsmartcontrol|GSmartControl]] (GUI) to check for warnings to update the firmware.
Normally the manufacturer provides these proprietary firmware images packed within update tools, available as bootable CD ISO images.

In case they used FreeDOS started by syslinux, instead of booting from CD, you can extract the (floppy) image inside the ISO and create a new entry in your GRUB2 boot menu.

For the Crucial m4 firmware update, the ''syslinux.cfg'' looks like this:
{{{
LABEL default
 KERNEL memdisk
 append initrd=boot2880.img floppy raw
}}}

Copying the files ''memdisk'' and ''boot2880.img'' to the boot partition allows them to be started from GRUB2, by adding an entry in ''/etc/grub.d/40_custom'':

{{{
# assuming an ext2 boot partition on (hd0,5) -- compare to your other GRUB2 entries
menuentry "m4 firmware update" {
  insmod ext2
  linux16 (hd0,5)/isos/m4memdisk floppy raw
  initrd16 (hd0,5)/isos/boot2880.img
}

}}}

Afterwards run {{{update-grub}}} to apply the changes. Reboot and select the created boot entry, then follow the firmware update menu. After completion, restart the computer.

== SSD related bug reports ==

This is a list of SSD related bug reports. It is probably better to come up with a user tag to use instead of listing them all here.

 * DebianBug:600523
 * DebianBug:603735
 * DebianBug:648868
 * DebianBug:683698
 * DebianBug:717313

Translation(s): none


This page is about optimal set up of an SSD (Solid State Drive). This page should be kept clean enough for beginners to get the most basic idea.

Basics

  • Use a reasonably recent Linux kernel (at least 3.2 or newer).
    • SSD caching is only supported on Linux 3.9 or newer.
  • Use the latest firmware for the SSD
    • Use a command like: "sudo smartctl -a /dev/sda" to check for issues.

    • Update firmware as needed.
  • Use the ext4 filesytem (the most mature filesystem) unless you have reason not to.
    • The btrfs filesytem is still in experimental state (as of kernel 3.11) but supports additional mount options like "ssd".
  • Have enough DRAM required to operate without swap space under normal workloads.
    • You need a swap partition that is larger than your DRAM to save all the DRAM content securely for hibernation.
    • If your SSD size is too small for your DRAM size, think about placing your swap on the larger classic HDD.
    • If you are planning on doing a huge amount of writes (more than 40-50 GB per day), it is advised to avoid SSDs that use TLC NAND.

These may also help:

Partitions and Alignment

You should consider to use the Multi HDD/SSD Partition Scheme to keep variable and bulk data on the HDD(s) and establish a fallback redundancy, if the system also has a HDD available (internal or external spinning disk).

Since Wheezy, all tools should automatically align filesystems and partitions to the 4096 byte page size. This is one of the most important optimization aspects. Here are good links for this subject:

Mounting SSD filesystems

The performance of SSDs is also influenced by filesystem mounting options:

  • Add the "noatime" (or "relatime") mount option in /etc/fstab, to disable (or significantly reduce) disk writes whenever a file is read.
    • This improves filesystem read performance for both SSDs and HDDs.
  • If desirable, enable the "discard" filesystem options for automatic/online TRIM.

    • Set "discard" mount option in /etc/fstab for the ext4 filesystem, swap partition, Btrfs, etc. See mount(8).
    • Set "issue_discards" option in /etc/lvm/lvm.conf for LVM. See lvm.conf(5).
    • Set "discard" option in /etc/crypttab for dm-crypt.
  • The "discard" options is not needed if your SSD has enough overprovisioning (spare space) or you leave (unpartitioned) free space on the SSD.

  • The "discard" options with on-disk-cryptography (like dm-crypt) have drawbacks with security/cryptography.

Example for dm-crypt's /etc/crypttab:

#<target name>    <source device>            <key file>  <options>
var  UUID=01234567-89ab-cdef-0123-456789abcdef  none  luks,discard

After changing filesystem options, update settings in all initramfs images:

$ sudo update-initramfs -u -k all

(!) Alternative to setting the "discard" options is to set up an offline-trim cronjob that runs time fstrim -v  (or mdtrim) on the ssd mountpoints periodically. Until software raid (md device layer) has trim support, you could use something like mdtrim (https://github.com/Cyberax/mdtrim/).

Reduction of SSD write frequency via RAMDISK

Use of RAMDISK can stop constantly changing files from hitting on the SSD (it may hit SSD via swap). RAMDISK configuration may be performed via

  • Set RAMTMP, RAMRUN and RAMLOCK to "yes" (in /etc/default/rcS or /etc/default/tmpfs since wheezy)
  • /etc/fstab: line such as "tmpfs /tmp tmpfs noatime,nosuid 0 0"
  • Optionally, make system only flush data to the disk every 10 minutes or more:
    • Kernel settings like the "dirty_buffer_ratio" etc. may only be available as non-path/mount specific global settings.
    • Mount option "commit=600" in /etc/fstab. See mount(8).
    • Or better, use pm-utils (Debian BTS #659260), tlp, or laptop-mode-tools (also optimizes read buffers) to configure the laptop-mode even under AC operation.

    /!\ Attention: Increasing the flushing interval from the default 5 seconds (maybe even until proper shutdown) leaves your data much more vulnerable in case of lock-ups or power failures, and seems to be a global setting.

Enabling RAMTMP may cause some (broken) applications to run out of temporary write disk space. Setting TMPDIR environment variable for those programs pointing to a writable disk space should fix their situation.

Please note files in /tmp are wiped out upon reboot unless /etc/default/rcS is set to something other than TMPTIME=0 (if not set, 0 is the default value).

Persistent RAMDISK

As an advanced option, you may consider to use persistent RAMDISK (dedicated read/write RAM buffer that gets synced periodically and on startup/shutdown) with anything-sync-daemon or goanysync set up:

  • /home (synced to work-data-fs raid only once a day?), you only risk settings the true work in /home/*/work-data is on a dedicated raid
  • /home/*/work-data/volatile (synced more frequently, once per hour?)
  • /home/*/Downloads (synced to bulk-data-fs once a day?)
  • /var completely if supported (syncing once a day? avoids spin-ups and allows to save /var also to SSD), at least set this up for
    • /var/log if supported
    • /var/cache/apt/archives
      • Configure apt to delete package files after installing, to minimize the data to sync.

Options to having logs copied into RAM:

If /home is not on a persistent ramdisk, use profile-sync-daemon to have the browser database and cache copied into RAM during uptime (http://ubuntuforums.org/showthread.php?t=1921800 https://github.com/graysky2/profile-sync-daemon)

  • /home/*/<browser-cache-and-profiles> (synced to root-fs or home-fs)

Further improvement: Patch anything-sync-daemon or goanysync to use a (copy-on-write) union filesystem mount (e.g. http://aufs.sourceforge.net) to keep changes in RAM and only save to SSD on unmount/shutdown (aubrsync), instead of copying all data to RAM and having to sync it all back.

Low-Latency IO-Scheduler

The default I/O scheduler queues data to minimize seeks on HDDs, which is not necessary for SSDs. Thus, use the deadline scheduler that just ensures bulk transactions won't slow down small transactions: Install sysfsutils and

  • echo "block.sdX.queue.scheduler = deadline" >> /etc/sysfs.conf

(adjust sdX to match your SSD) reboot or

  • echo deadline > /sys/block/sdX/queue/scheduler

In systems with different drive types you can adjust settings with a udev rule (create /etc/udev/rules.d/60-ssd-scheduler.rules):

# set deadline scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"

To check if the kernel knows about SSDs try:

  # for f in /sys/block/sd?/queue/rotational; do printf "$f is "; cat $f; done
/sys/block/sda/queue/rotational is 1
/sys/block/sdb/queue/rotational is 1
/sys/block/sdc/queue/rotational is 0   <=== Only this is SSD!

To switch scheduler manually issue:

# echo deadline > /sys/block/$YOURDRIVE/queue/scheduler

To see results:

# for f in /sys/block/sd?/queue/scheduler; do printf "$f is "; cat $f; done                                                                                        
/sys/block/sda/queue/scheduler is noop deadline [cfq] 
/sys/block/sdb/queue/scheduler is noop deadline [cfq] 
/sys/block/sdc/queue/scheduler is noop [deadline] cfq  <== That is!

The dumb "noop" scheduler may be a little faster in benchmarks that max out the throughput, but this scheduler causes noticeable delays for other tasks while large file transfers are in progress.

/etc/fstab example

Here is an example of /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
### SSD: discard,noatime
### match battery operation default for commit JOURNAL_COMMIT_TIME_AC in Add files in /etc/pm/config.d/*
/dev/mapper/goofy-root /               ext4    discard,noatime,commit=600,errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=709cbe4a-80c1-46cb-8bb1-dbce3059d1f7 /boot           ext4    discard,noatime,commit=600,defaults        0       2
### SSD: discard
/dev/mapper/goofy-swap none            swap    sw,discard              0       0
/dev/mapper/goofy-chroot /srv/chroot         btrfs    ssd,discard,noatime 0       2
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0

/etc/lvm/lvm.conf example

...
# This section allows you to configure which block devices should
# be used by the LVM system.
devices {
...
    # Issue discards to a logical volumes's underlying physical volume(s) when
    # the logical volume is no longer using the physical volumes' space (e.g.
    # lvremove, lvreduce, etc).  Discards inform the storage that a region is
    # no longer in use.  Storage that supports discards advertise the protocol
    # specific way discards should be issued by the kernel (TRIM, UNMAP, or
    # WRITE SAME with UNMAP bit set).  Not all storage will support or benefit
    # from discards but SSDs and thinly provisioned LUNs generally do.  If set
    # to 1, discards will only be issued if both the storage and kernel provide
    # support.
    # 1 enables; 0 disables.
    #issue_discards = 0
    issue_discards = 1
}
...

Smaller system with SSD

See

Adding vm.swappiness in sysctl for the kernel

As per http://evolvisforge.blog.tarent.de/archives/68 which has come on p.d.o. as well as on 29/07/2013 the following needs to be added in /etc/sysctl.conf.d/ for better longevity of the disc:

# /etc/sysctl.d/local.conf

#vm.swappiness=0
vm.swappiness=1

Setting vm.swappiness=0 is more aggressive but may cause out-of-memory events. http://java.dzone.com/articles/OOM-relation-to-swappiness

Note: together with other settings vm.swappiness may be a considerable enhancement to I/O performance; worth reading: http://rudd-o.com/linux-and-free-software/tales-from-responsivenessland-why-linux-feels-slow-and-how-to-fix-that

Upgrading the Firmware

Some problems might occur due to firmware bugs. Therefore, use tools like smartctl (terminal) or GSmartControl (GUI) to check for warnings to update the firmware. Normally the manufacturer provides these proprietary firmware images packed within update tools, available as bootable CD ISO images.

In case they used FreeDOS started by syslinux, instead of booting from CD, you can extract the (floppy) image inside the ISO and create a new entry in your GRUB2 boot menu.

For the Crucial m4 firmware update, the syslinux.cfg looks like this:

LABEL default
        KERNEL memdisk
        append initrd=boot2880.img floppy raw

Copying the files memdisk and boot2880.img to the boot partition allows them to be started from GRUB2, by adding an entry in /etc/grub.d/40_custom:

# assuming an ext2 boot partition on (hd0,5) -- compare to your other GRUB2 entries
menuentry "m4 firmware update" {
  insmod ext2
  linux16 (hd0,5)/isos/m4memdisk floppy raw
  initrd16 (hd0,5)/isos/boot2880.img
}

Afterwards run update-grub to apply the changes. Reboot and select the created boot entry, then follow the firmware update menu. After completion, restart the computer.

This is a list of SSD related bug reports. It is probably better to come up with a user tag to use instead of listing them all here.