Micro-ISV.asia

Monday, 8 February 2010

Organizing Your Data Between an SSD and HDD

Filed under: Hardware & Gadgets — Jan Goyvaerts @ 19:43

In the past, when hard disks were relatively expensive, the best advice was usually to buy the biggest disk you could afford. Larger disks tended to offer a lower cost per megabyte (!), except perhaps for the largest model. Though that disk would seem to offer a lot of space, you’d run out of space around the time your PC was heading for obsolescense.

When hard disks came down in price and a the difference between a hundred gigabytes more or less became pocket change, the advice was to put your operating system on a separate spindle (hard disk). Hard disks have become the bottleneck in PC performance, and seek time is the bottleneck in hard disk performance. Desktop operating systems assume hard disks respond “instantly”. When accessing the disk, the operating system waits however long it takes for the disk to respond. That’s why Windows grids to a halt when an application is furiously reading from or writing to disk. By installing Windows (and its swap file) on one disk and saving your data files on another disk your applications are less likely to tie up the operating system drive and thus Windows itself. This is particularly good advice when working with virtual machines. You don’t want two or more instances of Windows to compete for attention from the same disk.

Today we’re starting to measure hard disks in terabytes. A 2 TB model comes in at about $200, or 10 cents per gigabyte. Solid state drives (flash drives or SSDs) have come of age as well. A 250 GB drive like I recently installed costs about $750 or 3 dollars per gigabyte. That makes the SSD thirty times more expensive than the HDD. (I’ve rounded prices and capacities to get whole numbers. Prices change every day anyway.) That means that unless you’re storing very little data or don’t care about how much money you’re spending, you’ll be using both SSD and HDD drives in the near future.

Since SSD drives don’t have spindles or any other mechanical parts, they have virtually no seek time. So the old advice of putting your OS on a separate drive no longer applies. The OS goes onto your SSD together with everything else that you need fast access to. In my case, that means everything I use when developing software. That includes VMware and all its virtual machines, so all running virtual machines benefit from the SSD’s speed. It also includes temporary files, such as Lightroom’s cache folder.

I have split my 256 GB SSD into two partitions. The reason for this is not speed but backup strategy. I’ve allocated 50 GB to the boot partition with Windows 7 and all applications. I back this up by making an image of the partition to an external hard disk. I do this when I’ve installed new software and I’m happy with the configuration. This gives me a point to go back to if the operating system or an important application gets messed up in the future. The remaining 200 GB is the data partition which I back up daily by synchronizing it with an external hard disk. Version histories are stored on both the SSD and the external backup. The Just Great Software applications and their source code don’t take up that much space. So I put all of it on the SSD for convenience.

The second drive in my PC is a 500 GB mechanical hard disk that I’ve been using for some time. This disk stores my photographs, music files, applications I’ve purchased and other downloads, and more random stuff that takes up lots of space but isn’t important to my day-to-day work. This stuff also gets backed up by synchronizing it with an external hard disk.

To budget all this, get the biggest SSD you can afford. If you can only afford 64 GB, that’s way better than nothing. Install the OS on it and fill it with the files you work with most often. You can split a 64 GB drive into two 32 GB partitions just fine. If you have more files than the SSD holds, put the remainder on a mechanical hard disk.

Don’t fill the SSD completely. Leave about 10% to 20% free space so the drive’s wear-leveling algorithm has room to move things around as blocks are erased. SSDs cannot overwrite data. They need to erase it first, usually in blocks of 1 MB. TRIM support in Windows 7 and new SSDs allows the drive to be proactive about erasing unused space. But that only works if there actually is unused space. The free space also gives you headroom for larger temporary files.

Thursday, 4 February 2010

Hot-Plug Hard Disks Like They’re USB Sticks with AHCI

Filed under: Hardware & Gadgets — Jan Goyvaerts @ 12:04

My upgrade to an SSD drive was going to require a reinstall of Windows anyway. I had to finally upgrade from XP to Windows 7 to get the TRIM support the SSD drive needs.

So while I was at it, I replaced my ASUS P5K motherboard with a Gigabyte EP45-UD3R. The difference between the two is that the Gigabyte has the ICH10R chipset from Intel which supports AHCI (Advanced Host Controller Interface). This allows SATA drives to run natively as SATA drives enabling features such as hot-swapping. The old 320 GB hard disk that I replaced with the SSD drive now serves as removable storage for backups. I simply slide it into a SATA drive cage for 3.5″ disks that I installed into my computer long ago. It only takes a few seconds for Windows to recognize it. When I’m done, I use the “safely remove hardware” icon in Windows to eject it like it was a USB drive. Then I take it out. (I don’t know why Microsoft chose the word “eject”. The disk doesn’t fly out of the cage.)

In the past I never used the drive cage much. Without AHCI you can’t plug or unplug hard disks without rebooting the PC. Now I use it all the time. It’s just as convenient as USB drives, except that internal drives are cheaper, and run at full speed. Modern hard disks are typically about twice as fast as the maximum speed supported by USB 2.0.

To use AHCI you need a motherboard that supports it and you need to enable AHCI in the BIOS before you install Windows. Though my Gigabyte motherboard supports AHCI on both its SATA controllers (one Intel and one Gigabyte), both were set to IDE mode by default. With the SATA controllers set to IDE you can use SATA hard disks, but you won’t get the all benefits that SATA provides. I suppose IDE mode is the default because Windows XP does not support AHCI unless you know how to inject drivers during the setup process.

Your operating system also needs to support AHCI. Windows XP needs drivers that can only be loaded during the setup process. Windows Vista and 7 have built-in drivers for AHCI.

Wednesday, 3 February 2010

A Flashy New PC

Filed under: Hardware & Gadgets — Jan Goyvaerts @ 12:04

Actually, I’m still using pretty much the same setup you can see in my 2009 behind the scenes post. But my PC is a whole lot flashier now, at least on the inside.

I replaced the 320 GB hard disk that I was using as the system drive with a 256 GB SSD (solid state disk). Essentially an SSD is a flash drive just like those USB sticks you see everywhere, but with much higher capacity, performance, and price packaged into the form factor of a 2.5″ hard disk. Though 2.5″ disks are normally used in notebooks rather than desktops, you can install it into a desktop just fine. Since the device weighs almost nothing and has no movable parts, I didn’t even bother with a drive cage to fit the 2.5″ drive into a 3.5″ space. Two screws into one side hold it up perfectly well.

The main benefit of SSD drives is speed. Particularly when multi-tasking. When using a mechanical hard disk, you don’t want to do things like reverting a virtual machine to a running snapshot while at the same time launching Delphi 2010. Each of those tasks is no problem for the hard disk. Though the virtual machine may have a gigabyte of RAM, the file is read linearly, which hard disks excell at. Delphi 2010 loads lots of packages and DLLs, but it normally launches fast enough. But when your computer tries to do both, the hard disk’s head constantly tries to move between the virtual machine files and the Delphi files. That causes both tasks to take seemingly forever while the disk scrambles back and forth without getting much done. Seek time is killing performance.

SSDs have no mechanical heads and thus no seek time. Reading two sets of files simply takes the added time of reading each of those sets. Loading a virtual machine and an IDE at the same time takes about as long as loading them one after the other.

For me, the fact that SSD drives can multi-task is the killer feature. My quad core CPU easily runs mulitple applications. Now I have a storage device that can as well. I no longer have to worry that a lengthy 7-zip process is tying up my ability to quickly launch another instance of Delphi. And even when doing nothing, big applications that load lots of small files such as DLLs start much faster. That includes Windows itself. I haven’t run any formal benchmarks, but the difference between my old and new systems is very obvious, even though all I did was replace a hard disk with a flash drive, and upgrade from XP to Windows 7.

If you’re planning to install an SSD into your computer, you’ll need to make sure you have a drive that supports TRIM. When I bought my Crucial drive in November 2009 it came with old firmware without TRIM support. Upgrading the firmware was easy. I downloaded a .iso file from Crucial’s site to burn a bootable CD. Booting from that CD with the flash drive installed took care of the upgrade.

You’ll also need to upgrade to Windows 7 if you haven’t already to get TRIM support in the operating system. One problem with flash drives is that they can’t overwrite data. They have to erase the data first, and then write new data. While they can write data in small clusters (e.g. 4 KB), data can only be erased in large blocks (e.g. 1 MB). Obviously you don’t want your drive to move around 1 MB of data for each 4 KB page it writes. This is what caused early SSD drives to lose their performance as they filled up. What the TRIM command does is to tell the drive to erase the space that was used by files you’re deleting. Mechanical hard disks don’t do this. They just leave the old data in place and overwrite it when you save new files.

Today a 256 GB flash drive still costs as much as many people spend on a whole PC these days. But if you use your PC intensively and you’ve got a reasonably modern system already, replacing your hard disk with an SSD drive will do more for performance than buying a new PC with a traditional hard disk. If you keep the old hard disk as a second drive for storing large data files, one of the 128 GB or 64 GB SSD models may do the job just fine. 64 GB is plenty for a Windows 7 boot drive. The main reason I shelled out for the 256 GB model is that I use lots of virtual machines for testing my applications on various versions of Windows. Those take up a lot of space, and I want my virtual machines to boot as fast as my actual PC.

« Previous Page