====== Using a SSD as Boot Device ====== If you are lucky enough to have a SSD drive available as boot device you'll certainly want to use it.\\ One important fact to know about SSDs is that you need to "clean" them on a regular basis to maintain top performances. This is done using the TRIM command: TRIM allows the OS to "inform a solid-state drive (SSD) which blocks of data are no longer considered in use and can be wiped internally". Without using TRIM, the SSD speed decreases after a while so if you have a solid-state drive that supports TRIM, you should enable it so your SSD remains fast over time. ===== Determine if Your SSD supports TRIM ===== You first need to make sure that your SSD supports the TRIM command, to do that use the following commands: sudo hdparm -I /dev/sda | grep "TRIM" You might have to use another device identifier than// /dev/sda// for you it might be// /dev/sdb// or// /dev/sdc//. To get your disk identifier, use: sudo fdisk -l ===== fstab or cron ? ===== ==== Online discard in fstab ==== 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: sudo nano /etc/fstab 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: # / was on /dev/sdb1 during installation UUID=1cd2fc4f-7d99-4c7a-8ea7-6f9a2d5e5960 / ext4 discard,errors=remount-ro 0 1 ==== 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): sudo nano /etc/cron.daily/trim and paste this: #!/bin/sh LOG=/var/log/trim.log echo "*** $(date -R) ***" >> $LOG fstrim -v / >> $LOG fstrim -v /home >> $LOG 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: sudo fstrim -v / The output should look similar to this: sudo fstrim -v / /: 8158715904 bytes were trimmed Once you've added your SSD partitions, save the file and make it executable using the following command: sudo chmod +x /etc/cron.daily/trim 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]]