A PCRE internal error occured. This might be caused by a faulty plugin

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
install:ssd [2014/01/13 14:56]
admin created
install:ssd [2014/01/14 00:15] (current)
admin [Using a daily cron job]
Line 19: Line 19:
 ===== fstab or cron ? ===== ===== fstab or cron ? =====
 ==== Online discard in fstab ==== ==== Online discard in fstab ====
-There are mainly two ways to use TRIM directly in fstab using online discard, but this seems to be **NOT RECOMMENDED**.\\ +Although ​using online discard ​(in fstab) ​seems to be **NOT RECOMMENDED**, in case you really want to use this technique, open /etc/fstab as root with a text editor:
-In case you really want to use this technique, open /etc/fstab as root with a text editor:+
 <​code>​ <​code>​
 sudo nano /etc/fstab sudo nano /etc/fstab
-<​code>​+</code>
  
 And add the "​discard"​ option (separated by a comma and no space!) to the SSD partitions you want to enable TRIM for. Here's an example: And add the "​discard"​ option (separated by a comma and no space!) to the SSD partitions you want to enable TRIM for. Here's an example:
Line 31: Line 30:
 UUID=1cd2fc4f-7d99-4c7a-8ea7-6f9a2d5e5960 /               ​ext4 ​   discard,​errors=remount-ro 0       1 UUID=1cd2fc4f-7d99-4c7a-8ea7-6f9a2d5e5960 /               ​ext4 ​   discard,​errors=remount-ro 0       1
 </​code>​ </​code>​
 +
 +
 +==== Using a daily cron job ====
 +Using a timed cron job, the SSD trimming will occur on a regular basis you decide of (daily is probably a good choice). **This is the recommended way to TRIM your SSD**.
 +
 +To use a daily cron job (so the trimming will occur once a day) for TRIM (fstrim), open /​etc/​cron.daily/​trim as root with a text editor (/​etc/​cron.daily/​trim doesn'​t exist so this will create the file):
 +<​code>​
 +sudo nano /​etc/​cron.daily/​trim
 +</​code>​
 +
 +and paste this:
 +<​code>​
 +#!/bin/sh
 +LOG=/​var/​log/​trim.log
 +echo "*** $(date -R) ***" >> $LOG
 +fstrim -v / >> $LOG
 +fstrim -v /home >> $LOG
 +</​code>​
 +
 +The last two commands in the code above perform the actual trimming for the root (/) and home (/home) partition and you need to edit them: here, add the SSD partitions for which you want to enable the daily TRIM job (usually, you must add "/"​ if the root partition is on the SSD and "/​home"​ if you've set up a separate home partition).
 +
 +Before saving the file, you can check if the fstrim command works:
 +<​code>​
 +sudo fstrim -v /
 +</​code>​
 +
 +The output should look similar to this:
 +<​code>​
 +sudo fstrim -v /
 +/: 8158715904 bytes were trimmed
 +</​code>​
 +
 +Once you've added your SSD partitions, save the file and make it executable using the following command:
 +<​code>​
 +sudo chmod +x /​etc/​cron.daily/​trim
 +</​code>​
 +
 +The system executes the daily cron (using anacron, even if your computer is turned off at that time, the job will still be performed later on) jobs at around 06:25 so each day after that time, you can check the /​var/​log/​trim.log log file to see the fstrim output.
 +
 +reference: [[http://​www.webupd8.org/​2013/​01/​enable-trim-on-ssd-solid-state-drives.html]]