Mittwoch, 12. Februar 2014

Get better performance and life from your SSD in Linux-based systems

Rule 1: Special flags for your mounts

For all SSD devices in your system remove ‘relatime’ if present and add ‘noatime’ so it looks something like this:

/dev/sdaX  /  ext4  defaults,noatime,errors=remount-ro  0  1
/dev/sdaY  /home  ext4  defaults,noatime,errors=remount-ro  0  2

Rule 2: If it’s temporary move it to RAM

Every day applications generat a lot of log files so to reduce unnecessary writes to the SSD move the temp directories into a ram disk using the ‘tmpfs’ filesystem, which dynamically expands and shrinks as needed.
In your /etc/fstab, add the following:

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

On the following example the size of the filesystem is 512 megabyte, if you use "defaults" it's 50% of the RAM.

tmpfs  /tmp  tmpfs  size=512m,noatime,mode=1777  0  0
tmpfs  /var/spool  tmpfs  size=512m,noatime,mode=1777  0  0

tmpfs  /var/tmp  tmpfs  size=512m,noatime,mode=1777  0  0


Rule 3: Perform TRIM cleanups periodically

Trim by “Batched Discard” is very simple. This can be manually with the following command in a terminal with root privileges or, for example, regularly via cron job to perform.

sudo fstrim -v /

If you want to let a Batched Discard regularly run automatically so that a straight editor with root privileges , the file /etc/cron.weekly/batched_discard (weekly) or /etc/cron.daily/batched_discard (daily) with the following content:

#!/bin/sh
# call fstrim to trim all mounted file systems which support it
set -e
LOG = /var/log/batched_discard.log
echo "*** $(date -R) ***" >> $LOG
exec /usr/sbin/fstrim -v / >> $LOG

chmod +x batched_discard
 I think that crond.service is enabled by default in Fedora, but doesn't hurt to check.

systemctl status crond.service
 
That's it.
 

Montag, 3. Februar 2014

Yum: Pakete einfach mittels swap-Kommando austauschen

Wer z.B. XChat durch Hexchat austauschen möchte, der macht das im Terminal in der Regel mittels

su -
yum remove xchat
yum install hexchat
Es geht jedoch deutlich einfacher, wenn man das swap-Kommando von yum nutzt:
su -c'yum swap xchat hexchat'
In diesem Beispiel wird yum mittels swap-Kommand angewiesen, das Paket xchat zu löschen und gleichzeitig das Paket hexchat zu installieren. Das swap-Kommando bietet noch einige andere Möglichkeiten, Pakete auszutauschen, die man in den Man-Pages von yum nachlesen kann.