Optimizing Solid State Disks

This is meant to be a quick guide outlining how to setup a SSD, documenting the process at each step using a benchmarking software called CrystalDiskMark.

SSD Memory Cell Clearing

The first step is returning the disk to it’s original, unused state using a linux tool called ‘hdparm’. I refered to the ArchLinux Wiki which has a great explanation on the reasons behind it’s use, as well the procedure in using hdparm properly. Note, while the guide is provided by ArchLinux, hdparm is a tool available for use with Debian distro’s (Ubuntu, Mint, Crunchbang, etc) as well.

Benchmarks

Case #1: Clear BIOS, IDE mode

To illustrate the benefit the AHCI interface provides, let’s first benchmark with AHCI off. After formatting the drive, I jumpered the CMOS reset pins, confirmed the BIOS was set to IDE mode, and installed windows 7 using a bootable thumbdrive.

This is the ‘baseline’ benchmark.

Case #2: Update Motherboard BIOS

While I was downloading the windows 7 drivers for my motherboard I discovered that my BIOS was very out of date (I was running 1.70, 3.10 was current). Luckily ASROCK has a painless updating utility that loads the new BIOS from Windows.

After making this change I re-benchmarked, finding that the BIOS update had little effect on disk I/O.

Case #3: Prepare Windows for AHCI, enable in BIOS

Windows 7 needs AHCI drivers for the SATA chipset interface in order to read the disk at boot. Without them, Windows will simply not boot.

Error upon boot
1
STOP 0x0000007B INACCESSABLE_BOOT_DEVICE

In Microsoft’s infinite wisdom, AHCI drivers are not preloaded and is unable to adapt to a changed disk interface. Fear not however, there is a fix.

Microsoft’s Support Article #922976, details the problem, and provides a downloadable solution that involves modifying the Windows Registry which instructs Windows 7 to expect a different SATA controller, and to prompt for drivers. In case Microsoft’s support article changes, I will provide Microsoft’s instructions below:

DIY Registry Fix
1
2
3
4
5
6
7
8
9
10
11
Exit all Windows-based programs.
Click Start, type regedit in the Start Search box, and then press ENTER.
If you receive the User Account Control dialog box, click Continue.
Locate and then click one of the following registry subkeys:
      HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Msahci
      HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\IastorV
In the pane on the right side, right-click Start in the Name column, and then click Modify.
In the Value data box, type 0, and then click OK.
On the File menu, click Exit to close Registry Editor.
Reboot
Install AHCI drivers provided on your motherboards support page

After enabling AHCI, the benchmark data clearly speaks for itself. Predictably the largest increase involved Random Reads of 4KB with Queue Depth (QD) of 32, increasing 887.09 percent to 226.79 MB/s! In plain English this test’s the disk’s ability to concurrently (32 times) read a 4KB file. 4 KiloBytes also happens to be the generally accepted cluster size for most disk partitions, meaning it is testing the smallest readable file.

This increase in Random Read 4kB (QD=32) thruput is attributed to Native Command Queuing (NCQ), a feature enabled by AHCI. NCQ is a feature that re-organizes I/O functions into similar groups to increase processing efficiency. However without concurrent reading, NCQ is of little help evidenced in the Random Read 4kB (QD=1) benchmark.

For more information, refer to the NCQ reference provided by the Serial ATA International Organization.

Case 4: Updating SSD Firmware

I purchased the Crucial M4 SSD relatively soon after it was made available for sale in the Fall of 2011. As such the disk’s firmware was 7 releases behind the latest revision 070H. Since there was no risk of losing information (only time associated with formatting & reinstalling Windows), I downloaded Crucial’s latest firmware update.

Roughly ten minutes later the firmware was up to date, and I was benchmarking for the last time. The results were almost as dramatic as Case #3, with sequential reading almost hitting 500 MB/s.