SSD: Optimizing Windows

optimizing windows for solid-state drive operation

© 2012 by KV5R. Rev. August 5, 2012.

Check some things

  1. To determine if Windows 7 has detected the drive as an SSD, run (Start, Accessories, System Tools) Disk Defragmenter and click the ‘Configure Schedule’ button (it might say ‘Turn on Schedule’ if it was already off). Make sure ‘Run on a schedule’ is checked, then click ‘Select Disks.’ If your SSD does not show up in the list, that means Windows has detected it as an SSD, and thus removed it from the list of drives that can be scheduled for defragmenting.
  2. To check if Windows is using TRIM, open a cmd window (as Administrator) and type fsutil behavior query disabledeletenotify — if it returns 0, then TRIM is on; if 1, then not. Note that the SSD must be TRIM-aware. Windows 7 sets TRIM to on by default, even with hard drives, and XP and Vista do not have TRIM at all, but you can get TRIM functionality by purchasing an Intel SSD and installing the Intel Solid-State Drive Toolbox software.
  3. Windows 7 should optimize certain things for SSD, based on a high Windows Experience Index (WEI) score, but you need to refresh it after making such hardware changes. Go to Control Panel, Performance Information and Tools. It may say, “Your Windows Experience Index needs to be refreshed.” Click it and do so. After it’s done, your Disk Data Transfer Rate WEI score should jump up to about 7.8.
  4. Then, you can reboot and then run services.msc and look at the Superfetch service. Windows should have set it to Manual and not Started.
  5. Many articles say to go into the registry and check to see if it changed Prefetch and Superfetch, and if not, change both to either 0 (off) or 2 (Boot files only). How: Regedit HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters, and on the right side look for two keys called EnablePrefetcher and EnableSuperfetch. They will likely be on 3 (all files). Double-click each and set them to 2 (boot-files only), or 0 (disabled). However, if the Superfetch service is not running, then these keys don’t matter, because Prefetch, Superfetch, and ReadyBOOT (not ReadyBOOST) are all run by the Superfetch service, and if Windows detects that your SSD is fast enough, it simply turns it off. Note that there’s a LOT of confusion about this topic on-line, because a few years ago Microsoft initially recommended they both be off for SSDs, but later discovered that early SSDs were not really that fast and the settings should be on for better performance. Then the SSDs got a lot faster, and once again, the settings should be off. Lots of people are still confused, as outdated web articles persist.
  6. What I discovered, through both expert reading and personal testing, is that with the Superfetch service in Automatic and Started, and the above reg settings to 3 (all files), a reboot made W7 recognize the SSD and it set the Superfetch to Manual and Not Started, but didn’t change the reg settings. The boot time came down to 31 seconds, about 15 of which is AHCI waiting on spin-up and detection of my external terabyte drive. Not too bad! So, as it turns out, if the Superfetch service is not running in Services, the two registry settings just don’t matter. I also verified that with the reg settings at 3, and Superfetch service not running, %SystemRoot%\Prefetch\ReadyBoot\ReadyBoot.etl is not created, although there are some small tracing files. But again, YMMV.

Set some things

Most of the gurus recommend reducing the number of writes to SSDs to extend their lives. This is derived from some typical lists, with several of my own additions:

  1. Defragmenting: Make sure Windows Defragmenter is NOT set to defrag the SSD on a schedule. SSDs do NOT need to be defragmented, ever. In fact, the more the data is scattered around, the better (for wear-leveling purposes). You may wish to completely disable Windows Defragmenter. You can always run it manually, or on a schedule, for any hard drive you may have attached, but you do not wanting it defragging the SSD. Also, there are better defraggers, and you can disable the Disk Defragmenter service in services.msc and use your choice of after-market defragger for your hard drive(s).
  2. Move Windows TEMP folders to another drive: Windows and many apps write a load of transient files to TEMP folders. Change these to your hard drive and save wear and space on the SSD.
    1. Type Winkey-Pause, click Advanced System Settings to open the System Properties dialog, Advanced tab, click the Environment Variables button, and follow along.
    2. We see two sets of environment variables, user and system, and both have the variables TEMP and TMP. User will be set to %USERPROFILE%\AppData\Local\Temp, and System will be set to %SystemRoot%\TEMP when you open the edit box on it. We could just hard-code the TEMP and TMP variables to another location, but if your computer has more than one user, all users’ temp files will be mixed up in one folder, which won’t work.
    3. Set the System’s TEMP and TMP variables to H:\Temp (where H is your real hard drive letter).
    4. Set the Users’ TEMP and TMP variables to H:\Temp\%USERNAME% and it’ll makes sub-folders in H:\temp per user name.
    5. Reboot. Go to H:\temp and have a look (you don’t need to create it, as Windows will do so as soon as it’s needed). You can open a cmd prompt and type echo %temp% and it’ll show your user setting for the TEMP variable. Typing set will show the whole list of environment variables, many of which may be placed between % signs when you want to use them (that’s how I found the username variable we used above).
    6. Go to c:\Users\username\AppData\Local\Temp\ and c:\Windows\temp and delete the contents. If any file or folder therein cannot be deleted, it is either in use (something is writing to the temp folder directly, bypassing the TEMP variable you set before), or some files my have been orphaned in a locked state during a crash. You’ll want to monitor the old temp folders for a while to see if any programs are still using it. They may have cached the old temp folder name in the registry or elsewhere.
    7. I noticed that couple programs crashed the first time I tried to run them after changing the temp variables. Running them again made them locate the new temp folder and use it. If that doesn’t do it, you might have to search the registry for the old TEMP value and see if any installed programs wrote it into their relevant registry keys, and manually change them (else un-install and re-install the software so it can find the new TEMP value—sorta like using a tractor to weed a flowerbed).
  3. Move Cache locations to another drive: Many articles say to just relocate your whole User tree to another drive. I say, what’s the use of having an SSD and its fantastic speed if you’re gonna move everything but bare Windows off of it? But you should move as many temp and cache files from your SSD to an HDD as possible. Check the settings in your browser and other software that uses disk caching to see how to make them cache on a different drive. Note that most desktop users will use the SSD as the system drive, then also keep the big hard drive for data files. Laptop users will usually not have this option, so should simply turn browser caching completely off. Check your browser settings or options.
    1. Google Chrome: It makes thousands of cache files and dozens of databases that continually grow and change, and does not offer a way to move its cache folder. Some old postings say there’s a command-line switch to make Chrome remote its cache, but it doesn’t always work. To fix Chrome, you need to see my Fix Google Chrome page, Problem 2, for all the details.
    2. Likewise, you can put your email client, or at least its user-data folders, on the hard drive. There’s a ThunderbirdPortable, too, and it’s the best email client you can run on Windows anyway. But email clients don’t make nearly as many temp files as do browsers.
    3. Firefox: See this Mozilla support page.
    4. Internet Explorer cache: Who cares? 😉 Click the Gear, Internet Options, General tab, Browsing history Settings button, Move Folder button, and select the other drive and folder you want. Very simple (Chrome programmers, take note).
    5. Java Cache: Go to Control Panel, Java, General tab, Settings button, and either uncheck “Keep temporary Internet files on my computer,” or set the cache’s path to the hard drive (make a folder on it for misc. caches). Mine would’t work—“Change” is greyed out (more research…), so I just unchecked it. I use very few Java applets anyway. And remember, “Java is not JavaScript.” They aren’t even related. JavaScript, that you need to make most web sites (and particularly shopping carts) work properly nowadays, is in your browser, and any JavaScripts (not Java applets—different thing) that you run are stored in your browser cache, just like the HTML and the graphics are.
    6. Search on-line for more ways to migrate more of your apps to PortableApps on the hard drive. A big advantage of PortableApps (besides being free) is that they store all their settings and data in the tree where they are, not all over your drive and, best of all, not in the registry! Another big advantage is that they are portable—just drag the app’s folder to a USB stick, and away you go—program, settings, data, and all. When you want to “uninstall” a PortableApp, you just delete its folder and POOF! it’s gone and no trashy bits left behind. Though made for USB thumb drives, PortableApps will work just fine on a hard drive or SSD.
    7. For programs that you use a lot that really need the speed of the SSD, search on-line for ways to make them put their temp files on the hard drive.
    8. If you like to download and try a lot of different programs, and end up just un-installing most of them, try them in a Sandboxie sandbox on the hard drive first. You can install Sandboxie to the SSD, but make sure it puts the sandbox folder on the hard drive. Doing this will also help keep you from cluttering your registry, as most programs do not uninstall cleanly but leave traces behind.
  4. Disable the Windows indexing service: Run services.msc and find “Windows Search,” double-click it, and in the properties dialog, Stop it, and set Startup type to Disabled. The SSD is waaaay fast enough that it doesn’t need to be worn out with Windows indexing—that “helps you find...” bla-bla—nobody ever uses Windows Search anyway, because it’s about as useful as Windows Help…
  5. Move the C:\pagefile.sys off your SSD to the hard drive! Right-click Computer, select Properties, click Advanced System Settings, Advanced tab, Performance Settings button, Advanced tab, Virtual Memory Change button—(whew!) will finally present the “Virtual Memory” dialog. Uncheck the “Automatically Manage” box at the top. Set C: to “No paging file,” press Set button, ignore the complaint, then set your hard drive (your data drive) to use a paging file. You can either let windows manage it (and it will be way too big), or set it to a custom size. If you have like 8 gigs of RAM, I have found that 512 and 1024 are good numbers for the paging file size. Do not just turn it completely off, and do not set the initial size below 400—some programs need a paging file no matter how much RAM you have, and Windows needs some for crash dumps and such. Exit all that, reboot, and then verify that the pagefile.sys file is now in the root of your hard drive, not the SSD’s root. Again, this is not an option for laptop users.
  6. Disable Hibernate: It causes the entire contents of memory to be repeatedly written out to the drive, causing more SSD wear. Open a command prompt as administrator, and type powercfg -h OFF . Most people with laptops use hibernate to save battery power, but with an SSD the boot time is so fast (like 15-20 seconds) that you can just shut the computer down when not in use. Also, switching from a 10 watt hard drive to a 1 watt SSD will give the laptop battery time a boost.
  7. Disable hard disk sleep: Control Panel, Power Options, Change plan settings, Change advanced power settings, click the little plus next to Hard disk, then the little plus next to Turn off hard disk after, and if the Setting isn’t “never,” click it and erase whatever number is in the box. SSDs don’t need to sleep—they only use like a half-watt when idle (and 1-3 watts when active). Also, they need to be both idle and powered up at least 20 minutes a day (average) so they can do garbage collection.
  8. Disable unneeded services: Open and maximize services.msc. Take a look at them all. Some that you don’t need are obvious. For example, if you don’t have a Bluetooth device, or wireless network, or fingerprint reader, you can disable the relevant services. Be careful and read-up first, because disabling certain services can crash Windows and if that happens, it’s darn hard to get them re-enabled again! For the whole list, see the BlackViper site. That guy is the Windows Services guru.

Anyway, if all that sounds like a lot of mess you didn’t expect, well, consider these items:

  • You don’t really have to mess with any of it, but if you don’t, your SSD will wear out faster.
  • Much of the above will actually keep Windows cleaner and faster in the long run, with or without an SSD.
  • “Won’t moving all that stuff to a hard drive just slow it down and defeat the purpose of having an SSD?” Actually, no. Because, even though the SSD is 5-10 times faster than the hard drive, having the computer accessing two drives at the same time is even faster! Imagine your big app loading up, reading a bunch of files, and occasionally stopping to write out a temp file. Now imagine it had two pipelines and could do both at the same time…

Leave a Reply

Your email address will not be published. Required fields are marked *