Installing and Optimizing an SSD for OS X

Since I purchased my 15-inch MacBook Pro in June, I have been looking in to two upgrades: 8GB RAM and a solid state drive (SSD). When I spotted a 120GB OCZ Vertex 2 on NewEgg under $200, I jumped at the opportunity. After installing and using the drive for a while, I now wonder why I didn't make the switch to SSD sooner. I'll discuss the changes I made within OS X to optimize the performance of the SSD.

Like any other geek, I spent an unnecessary amount of time reading about optimizing SSD Drives (here and here) and aligning partitions (here and here), eager to get everything possible out of the upgrade. Without going in to an exorbitant amount of detail, the erasure block size of OCZ drives are 512KB. In order to prevent unnecessary reads/writes, we want partitions to start at the beginning of one of these blocks, or a multiple of 512KB. Apparently, it's impossible to do any type of manual alignment of partitions on the Mac. Partitions on HFS+, the Mac file system, are 4KB aligned. While this isn't desirable, I haven't found a way around it.

With that said, there are a few easy modifications that will increase the lifetime and performance of SSDs on OS X. Most of these are discussed at length in the links above. I chose to do only two: disable access time and prevent the RAM image from being written during sleep.

Access Time

Each time a file is read in OS X, a timestamp is written to the drive recording the time the file was last accessed. Disabling this will reduce the amount of writes on the SSD. In order to prevent OS X from recording the access time of files, we need to remount the drive with a special parameter: noatime. Create the file /Library/LaunchDaemons/noatime.plist with the following contents:

Save and restart. Verify the modification is active by running the command:

mount | grep " / "

in the terminal. The output should be similar to

/dev/disk0s2 on / (hfs, local, journaled, noatime)

RAM Image

Whenever OS X sleeps (the laptop is closed), the entire contents of RAM is written to the drive to ensure your data is there if the battery completely discharges. Disabling this features will prevent 4GB (in my case) from being written to the drive each time the MacBook Pro sleeps. To do this, run the following commands in the terminal:

sudo pmset -a hibernatemode 0
sudo rm /var/vm/sleepimage

Be aware that if the MacBook Pro sleeps because of low battery and isn't recharged before it completely runs out, all unsaved data in memory will be lost.

I strongly encourage you to make the switch to SSD if you can afford it and give up the storage. I hope this article gave you an idea of how simple changes can be made to optimize SSD performance on OS X. I'm sure many other tweaks exist: the command to stop the drive when the laptop is dropped can be disabled (SSDs ignore this command anyway), and this post discusses creating a RAM disk to store temporary files and prevent writes to the SSD. I'll also be writing an article in the near future about aligning partitions on Linux systems, so check back for that.

comments powered by Disqus