Pages

Monday, May 26, 2014

SSD TRIM

Since I have my new SSD (SanDisk SDSSDHP128G) I read a little about performance tuning for SSD's etc. One thing I read was to activate trim (if possible) and to deactivate noatime during mounting. I have only one SSD where I store my entire operating system on so the partition layout is fairly simple:

# grep sda /etc/fstab
/dev/sda1   swap   swap   defaults   0   0
/dev/sda2   /      ext4   defaults   1   1


One partition for my swap and another one for my root file system. To activate trim I had to check if it is supported by my SSD:

# hdparm -I /dev/sda | grep -i trim
           *    Data Set Management TRIM supported (limit 16 blocks)
           *    Deterministic read ZEROs after TRIM


The above output indicates that trim is supported. The only thing I needed to do was to change my mount options. First they look like:

# mount
/dev/sda2 on / type ext4 (rw)
...


Next I had to change the mount options inside the fstab file for my root file system:

# vi /etc/fstab
/dev/sda1   swap   swap   defaults   0   0
/dev/sda2   /      ext4   defaults,noatime,discard   1   1


Just a quick remount of the root file system:

# mount / -o remount

And both options were set successfully:

# mount
/dev/sda2 on / type ext4 (rw,noatime,discard)


A much more detailed description can be found on the Arch Wiki (incl. LVM, dm-crypt etc.) which is really worth a reading:

https://wiki.archlinux.org/index.php/Solid_State_Drives

No comments:

Post a Comment