Differences between revisions 21 and 22
Revision 21 as of 2012-11-24 15:48:45
Size: 6199
Comment:
Revision 22 as of 2012-11-24 16:01:04
Size: 6198
Comment:
Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:
 * Make system only flush data to the disk every 10 minutes or more.  * Optionally, make system only flush data to the disk every 10 minutes or more:
Line 23: Line 23:
  * Alternatively, and more selective than changing the global filesystem commit interval:   * Alternatively, and more selectively than changing the global filesystem commit interval:
Line 25: Line 25:
   * consider having logs copied into RAM with http://www.debian-administration.org/articles/661, http://www.tremende.com/ramlog or https://github.com/graysky2/anything-sync-daemon    * consider having logs copied into RAM with http://www.debian-administration.org/articles/661, http://www.tremende.com/ramlog or https://github.com/graysky2/anything-sync-daemon (if it supports this)
Line 30: Line 30:
Performance and disk wear of the solid state drive (SSD) can be optimized as follows. Performance of SSDs can be optimized as follows.
Line 32: Line 32:
 * by adding the "elevator=noop" kernel option to /etc/default/grub (and running update-grub).  * By adding the "elevator=noop" kernel option to /etc/default/grub (and running update-grub).

Translation(s): none


This describe SDD optimization with system having encrypted root and swap.

/!\ An important aspect in optimizing SSD performance is the file system and partition alignment (1 MiB borders aligned to the 4096 byte blocks of the hardware). This wiki page does not cover these issues.

Reducing writes to solid state disks (SSDs) or laptop hard disk drives (HDDs)

  • To disable or reduce disk writes during disk read access, add the "noatime" or "relatime" mount options in /etc/fstab.
  • Set RAMTMP, RAMRUN and RAMLOCK to "yes" (in /etc/default/rcS or tmpfs since wheezy).
    • /!\ RAMTMP will keep /tmp in RAM only, causing its content to be discarded on every shutdown! Using an increased commit interval or a sync scripts (see below) shall reduce disk writes significantly without discarding data on a regular basis.

  • Optionally, make system only flush data to the disk every 10 minutes or more:

    /!\ 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.

Optimizations for solid state disks (SSDs)

Performance of SSDs can be optimized as follows.

  • Use a recent Linux kernel. (>3.2)

  • By adding the "elevator=noop" kernel option to /etc/default/grub (and running update-grub).
  • Maybe enable the "discard" filesystem options for automatic/online TRIM. However this is not strictly necessary if your SSD has enough overprovisioning (spare space) or you leave (unpartitioned) free space on the SSD (http://www.spinics.net/lists/raid/msg40866.html). Enabling online-trim in fstab may just slow down some SSDs signficantly (https://patrick-nagel.net/blog/archives/337).

    • Set "discard" mount option in /etc/fstab for the ext4 filesystem, swap partition, Btrfs, etc. See mount(8).
    • Set "discard" option in /etc/lvm/lvm.conf for LVM. See lvm.conf(5).
    • Set "discard" option in /etc/crypttab for dm-crypt.

Note that using discard with on-disk-cryptogrpahy (like dm-crypt) also has drawbacks with respect to security/cryptography! See crypttab(5).

dm-crypt's /etc/crypttab:

#<target name>    <source device>            <key file>  <options>
var  UUID=01234567-89ab-cdef-0123-456789abcdef  none  luks,discard
  • You'll also need to update your initramfs: update-initramfs -u -k all

  • Optionally, 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/).

  • With btrfs, set "ssd" mount option in /etc/fstab to enable the SSD optimized disk space allocation scheme.

More: http://siduction.org/index.php?module=news&func=display&sid=78 http://forums.debian.net/viewtopic.php?f=16&t=76921 https://wiki.archlinux.org/index.php/SSD http://wiki.ubuntuusers.de/SSD

/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

...
# 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