Don’t fill up your disks

I recently commented on an interesting blogg entry regarding optimizing Lightroom, where there was some confusion about why you should keep a large portion of your disk unused (and how large is large enough).

Since it became a rather long comment, and since this is an important performance factor that isn’t talked about a lot, I am simply reposting my comment as an entry here… I’m lazy like that…

I just wanted to shed some light on the "Keep space on your hard drive" tip. Michael asks if he really needs 400GB free on his 1TB drive, and the answer is yes, if maximum performance is the goal, he does. This is not so much to improve stability (once you have enough free space to write any temporary files, unfragmented, even more free space doesn’t really help you in that regard) but rather because of the way traditional hard drives work. A hard drive’s performance is not consistent across the entire surface, but varies significantly depending on which part of the drive gets read or written.

Generally, a hard drive will be fastest while writing to the outer edges of the drive’s platters, and performance will decrease when writing closer to the center of the platters. For this reason, drives fill up from the edges toward the center. The specifics of at which points and to what degree performance is cut is drive model-dependant, but generally speaking, the last parts of the disk will have about half the read and write transfer performance of the first parts.

Typical examples of this can be seen in more detailed tests of hard drives, for instance http://www.tomshardware.com/reviews/2tb-hdd-7200,2430-6.html (just a test of three disks I chose at random to illustrate the point).

To get the absolute maximum speed from your disk, you shouldn’t normally use much more than 20-25% of the disk, the rest should be unused space. Getting disks that are four times as big as “needed” is expensive, of course, and exactly how much you want to fill your disk, and in other words how much performance degradation you will suffer, will be an individual question. But when you’ve passed 50-60% of your disk space, this starts to be a real factor.

Finally, this relates to traditional, mechanical hard drives. The story for SSDs is far more complex. While they theoretically don’t suffer any degradation depending on what memory addresses are written, the controllers on current SSDs (especially MLC-based disks) tend to run in to a lot of optimization problems with data writes once free space starts to get scarce. So, expensive as they may be, SSDs will also give you the best performance while they are primarily empty.

Lightroom exiting without a word on startup

I’ve been using Lightroom extensively for the last year or so, and apart from the program requiring processing power significantly beyond the state of the art to run smoothly (though not quite as slow as Apple Aperture), I’m quite smitten by it. I’ve moved my entire photo catalog from the past eight years into it.

So you can imagine my chagrin when it one day just stopped working. “Stopped working” in this case meant that the program would, after startup, simply exit once the splash screen disappeared. No error message. No nothing. I was never given the opportunity to click anything, access any menu etc.

My attempts to rectify the problem involved:

  • Swearing at the computer, accompanied by threatening gestures
  • Deleting my preferences file (apparently a go-to-solution when weird things happen in Lightroom)
  • Checking and rebuilding the catalog
  • Upgrading from 1.4.0 to 1.4.1
  • Restoring my catalog from a backup
  • Pulling my hair

none of which helped me at all. I could open other (or new) catalogs, but not my main catalog containing all my 30000+ images, even when I restored the catalog from a known good backup!

After a lot of mucking around, I noticed that Lightroom apparently exited at exactly the same moment every time, while drawing a particular image on screen. I tried removing that particular image (the raw-file) from the library, but that didn’t help at all. This was when it hit me: maybe the problem was with the cached previews? Maybe that particular preview was corrupted in some way?

Scanning and rebuilding the catalog apparently only works on the .lrcat file, not the cached previews. Since they don’t have any other significance besides performance improvements, I simply deleted the entire directory. And, lo and behold, Lightroom started right up (albeit a smidgen slower, since it had to reparse all the raw files). Problem solved. Stress-induced heart attack avoided.

So, in conclusion, one more trick to try when Lightroom is misbehaving is to simply delete your cached previews. I’m not saying it will fix your problem, but since it’s unlikely that it will have any negative impact (besides a performance hit the first time the previews are rebuilt), it can be worth a try.