Posted by Vincent Cheng on

My First SSD (Intel 330, 180GB)

I actually bought my very first SSD last year during Black Friday, but I never got around to swapping out my hard drive until after exams, and to blog about it until now, heh. It's a 180GB Intel 330, snagged from Newegg for roughly $0.58/GB, which in late 2012 was considered a pretty good deal (although I expect SSD prices to dip even further this year). I've heard from friends previously that I should consider purchasing a SSD, but I never really gave it serious thought until after another hard drive failure.

So long story short, I got this in the mail a while ago:

I'm actually very impressed with the boot speeds my laptop has now; previous it took ~30 seconds to boot from POST to gdm, and another minute to get an usable GNOME Shell environment. Now it takes about 10 seconds to get to gdm, and 2 seconds to have an usable shell, which is quite the improvement! And this is with Debian's sysvinit, not systemd; I suppose systemd may be able to shave off another second or two, but boot speed is no longer a compelling reason for me to consider switching from sysvinit to systemd.

Setting up and using the SSD itself has been pretty quick and painless; just remember to add "discard" to /etc/fstab to enable TRIM support. That's the only thing that really should be done; everything else (noatime, tmpfs, I/O scheduler changed to deadline/no-op, etc.) is optional, although I went ahead and did that anyways.

Brief explanation of my current setup now (more for my own reference than anything else, although I hope this helps someone):

Tmpfs & TRIM:

$ cat /etc/default/tmpfs
RUN_SIZE=3%
LOCK_SIZE=5242880 # 5MiB
SHM_SIZE=12%
$ cat /etc/fstab
UUID=xxxx  /             ext4        noatime,discard,errors=remount-ro 0       1
/dev/sr0   /media/cdrom0 udf,iso9660 user,noauto                       0       0
tmpfs      /tmp          tmpfs       noatime,size=85%,mode=1777        0       0

Note that I manually mount /tmp as tmpfs in /etc/fstab to override the defaults that /etc/default/tmpfs sets. To be specific, I don't want nosuid or nodev since that seems to cause troubles when setting up a pbuilder chroot (I have /var/cache/pbuilder/build symlinked to /tmp to avoid excessive disk writes when building Debian packages with pbuilder).

I also have /var/cache/apt/ symlinked to /tmp to avoid excessive disk writes when using APT. I regularly run apt-get clean to clear out my cache, so this isn't a problem for me; with 8 GB ram, and a tmpfs setup on /tmp to take up to 85% of my RAM, that leaves me with more than enough space in /tmp for day to day usage.

I also want Deadline to be the default scheduler for SSDs/flash media, and CFQ to be default for rotating disks, so I added an udev rule for that:

$ cat /etc/udev/rules.d/90-io-schedulers.rules
# set deadline scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"
# set cfq scheduler for rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="cfq"

That's pretty much it.

I've had to make minor adjustments to my workflow to accomodate the fact that my SSD is a lot smaller than my old hard drive, but it's still large enough for a dual-boot setup, along with all the programs that I use and most of my data (my videos/movies have to be stored on a separate drive though). I've already adopted the habit of compiling stuff in /tmp and building my Debian packages in a tmpfs /tmp before getting a SSD, so this hasn't disrupted my Debian packaging workflow very much either.

© 2012-2015 Vincent Cheng. Built using Pelican. Based on theme by Carey Metcalfe, available on GitHub, which is based on svbhack by Giulio Fidente, modified by myself.