siddou.tk

Optimize SSD on Debian 7 Wheezy

Following recommendations from Debian wiki:

Partitions and Alignment
fdisk -l /dev/sda

First partition should start at 2048 (by default in wheezy):

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e1ed0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   156301311    78149632   83  Linux
Disable swap usage
nano /etc/sysctl.d/local.conf
vm.swappiness=0

test at reboot:

cat /proc/sys/vm/swappiness
Enable dealine scheduler
apt-get install sysfsutils
echo "block/sda/queue/scheduler = deadline" >> /etc/sysfs.conf

test at reboot:

cat /sys/block/sda/queue/scheduler
Mounting SSD filesystems
nano /etc/fstab
UUID=81ca7822-367f-3542-902d-7472c3e1d250 /               ext4    discard,noatime,nodiratime,errors=remount-ro 0 $
UUID=42d43f6d-6362-437a-a65f-867e88235c5b none            swap    discard,sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
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

check at reboot:

mount

UPDATE

fstrim instead of discard

Since discard option in fstab slow down SSD, it’s might be better to run fstrim weekly instead. fstrim will also give an error if TRIM support is not enabled correctly (discard option don’t)
Install fstrim if necessary (by default in wheezy):

apt-get install util-linux

Setup cron job:

nano /etc/cron.weekly/fstrim
#! /bin/sh
for mount in / /boot /home; do
	fstrim $mount
done
chmod +x /etc/cron.weekly/fstrim

Tagged on: , , , ,

2 thoughts on “Optimize SSD on Debian 7 Wheezy

  1. .pQd

    it might also make sense to periodically execute fstrim to let the controller chip on the SSD drive know about unused sectors so they can be zero-ed [which is time consuming process] before they’ll need to be overwritten.

Leave a Reply

Your email address will not be published. Required fields are marked *