Optimize Windows 8 for use with a Solid State Drive (SSD)

Microsoft got most things right with Windows 8 and Solid State Drive’s (SSD drives have been around for a few years now). There are just a few things you have to check, the most important one is if your SATA controller is running in IDE or AHCI mode.

SATA – AHCI

To improve performance, make sure that your hard drive SATA mode is set to AHCI (Advanced Host Controller Interface) in your system’s BIOS. AHCI exposes SATA’s advanced capabilities – such as hot swapping and native command queuing (NCQ) – such that host systems can utilize them. Specifically the ‘native command queuing’ will give SSD drives a performance boost.

You should take note however: If you already have Windows 8 installed and want to change your SATA mode from IDE mode to AHCI mode, you’ll have to follow a simple procedure; otherwise your system will refuse to start Windows.

First we’ll have to set Windows 8 to boot into Safe Mode. Open an elevated command prompt (type CMD on Windows 8 Start screen, right-click the Command Prompt app and click Run as administrator from the menu (Figure)Run as administrator) and type the following command bcdedit /set {current} safeboot minimal and press [Enter] on your keyboard.

Restart your system, enter your BIOS and change your SATA mode to AHCI. After saving the BIOS changes, restart your system. Windows 8 will boot in SafeMode. Open an elevated command prompt and run the following command to remove the SafeMode boot option: bcdedit /deletevalue {current} safeboot. Restart the computer and boot normally, you should now be running in AHCI mode.

Below you’ll see the results of a benchmark I took using AS SDD Benchmark tool.

 

Standard SATA (IDE Mode) vs. Enhanched SATA (AHCI Mode)

 

Below I’ll explain some changes and/or misconceptions regarding Windows 8 settings and SSD drives.

Defrag

If you are familiar with SSD’s you could be aware that the general advice is to always make sure defrag is not running on your SSD drive. Disk defragmentation is unnecessary on an SSD drive and can even have a negative effect on the endurance of the drive.

In Windows 8, you’ll notice that defrag is set to run on your SSD drive (Figure)Defrag Settings. Do not switch this off manually!

Samsung Electronics Samsung 840 Series Solid State Drive (SSD) 250 sata 6.0 gb 2.5-Inch

According to a Microsoft Sr. Program Manager from the Storage and File System Team, Windows 8 (like Windows 7) supports the TRIM command (for details look at the right hand side bar on this page). The NTFS file system will send trim ‘hints’ when files are deleted or moved; SSDs use these hints to perform a cleanup in the background that helps them get ready for next writes. The SSD may choose to perform the optimization immediately, store the information for later optimization or throw away the hint completely and not use it for optimization since it does not have time to perform this optimization immediately.

In Windows 8, when the Storage Optimizer (the new defrag tool) detects that a volume is mounted on an SSD – it sends a complete set of trim hints for the entire volume again – this is done at idle time and helps to allow for SSDs that were unable to cleanup earlier – a chance to react to these hints and cleanup and optimizer for the best performance. The optimization is set to run once every 28 days.

No traditional defrag (moving files to optimizer there location for space and performance) is performed on SSDs.

One Potential Problem:

There is however one problem with defrag: If you run “Automatic Maintenance” from the Action Center, you will discover that your SSD drive is defragmented! That can’t be right. You can see from the screen shot below that my SDD drive was being defragmented. I checked with Intel’s SSD Toolbox, and found that this procedure ‘cost’ just over 20 GB of host writes (when run on my ‘old’ 120 GB Intel X 25-M drive), while my long term average stands at around 8-10 GB/day.

Defrag running on SSD drive

 

Testing by several people has revealed that the ‘problem’ seems to stem from the command that is used to run the scheduled defrag task which lists: defrag.exe -c -h -o -$ (Figure)Scheduled Task for Defrag. The problem is the last (undocumented) parameter $. When you remove this parameter from the task, and then run Automatic Maintenance you’ll notice that defrag will only run the TRIM function.

If you want to test this, please note that you would have to start the defrag GUI before removing the parameter. If you try to start defrag after changing the parameter it will refuse to start unless you choose the option Remove customized settings (which indeed puts the $ parameter back at the defrag command).

To work around this issue you have two options: Remove the parameter $ from the defrag command and whenever you need to make changes by using the defrag GUI remember you’ll remove the parameter after your changes. The other option would be to disable the scheduled defrag task, and replace it with a new task you create yourself (using the command/parameters defrag.exe -c -h -o).

Now there’s one other observation I’d like to add: So far I have seen NO evidence that the Automatic Maintenance will actually run a defrag. I’ve been watching my SSD drive, and although defrag says that optimization is needed, so far nothing has run on the drive (I’m also looking at the amount of host writes on a daily basis). Automatic Maintenance has run multiple times (Figure)Maintenace, but so far without running defrag on the SSD drive, so for now it looks that only choosing the option to run the Automatic Maintenance manually will trigger a defrag of your SSD drive.

Superfetch

Microsoft made some changes here too. The Superfetch service should be left enabled in Windows 8. When Windows 8 detects it is installed on a SSD drive, it will disable Superfetch by changing/removing a registry setting. But the Superfetch service also runs the Prefetcher function, and this should stay enabled on Windows 8.

Prefetch settings in the Windows 8 registry

The Prefetcher improves Windows boot time. A large number of files need to be read into memory and processed when a Windows system boots. It is not uncommon that different parts of the same file have to be loaded at different times. This would result in a significant amount of time the operating system spent opening and accessing files multiple times, where a single access would be more efficient. The prefetcher records a trace file of activity taking place when windows boots. Future boots can then use the information recorded in this trace file to load code and data in a better fashion.

Myth busting!

Yes, there are a lot of myths surrounding SSD drives. You should realize that most of the “Optimize” tips you’ll find can be traced back to first generation SSD drives. These 1st gen drives suffered from all kind of performance problems, both related to the quality (or lack thereof) of their flash memory and the drive controller.

On page 2 of this article I will tackle some of the misguided performance tweaks you’ll frequently find posted on the Internet.


Myth busting!

Yes, there are a lot of myths surrounding SSD drives. You should realize that most of the “Optimize” tips you’ll find can be traced back to first generation SSD drives. These 1st gen drives suffered from all kind of performance problems, both related to the quality (or lack thereof) of their flash memory and the drive controller.

OCZ 60GB Vertex Plus R2 Series SATA II 2.5-inch SSD

Some users might be surprised to find out that SSD drives have a ‘limited’ lifetime. They seem to think that since SSD drives don’t have ‘moving’ parts, wear-n-tear would be minimal. This isn’t the case. The write cycle, or the number of times a flash block may be erased and reliably programmed, is taxing for a flash drive. The maximum number of write cycles to an address block – the endurance – was initially small; about 10,000 write cycles in 1994, rising to 100,000 around 1998. Today’s number is anywhere from 100,000 cycles all the way to 1 to 5 million cycles! With current technologies (Wear leveling) write endurance is not a factor you should be worrying about.

Most consumer-grade SSD manufacturers offer a 3 or 5 year warranty with usage patterns that would allow 20 GB of host writes per day (I’m personally averaging 7-9 GB a day). Usage patterns are quite easy to obtain using software that ships (or can be downloaded) from the SSD manufacturers (such as Intel’s SSD Toolbox) or 3rd party tools such as SSD Life.

Many of the optimization tweaks are meant to reduce writing to the drive, so let’s bust some:

Disabling your Pagefile

This is what Microsoft has to say:

Most pagefile operations are small random reads or larger sequential writes, both of which are types of operations that SSDs handle well.

In looking at telemetry data from thousands of traces and focusing on pagefile reads and writes, we find that

  1. Pagefile.sys reads outnumber pagefile.sys writes by about 40 to 1
  2. Pagefile.sys read sizes are typically quite small, with 67% less than or equal to 4 KB, and 88% less than 16 KB.
  3. Pagefile.sys writes are relatively large, with 62% greater than or equal to 128 KB and 45% being exactly 1 MB in size.

In fact, given typical pagefile reference patterns and the favorable performance characteristics SSDs have on those patterns, there are few files better than the pagefile to place on an SSD.

I adjust my pagefile, I don’t disable it. I set a 1 GB pagefile on my C drive and a “System managed” pagefile on my D drive. The reason for the 1 GB pagefile on the C drive (System drive) is that Windows will need that when a BSOD occurs to write a dump (crash data) file. I only had a few BSOD’s in the last years because of a faulty graphics card, but I’d just make the setting as I describe above so I can forget about it, and not have to wonder why I don’t get a mini dump when I run into another problem months or years down the road.

The only reason I adjust my pagefile is because of space constraints. I have recently doubled my memory from 12 GB to 24 GB (yes, I do manage to get 70-80% of that ‘in use’ on occasion), and I wanted all that disk space that was wasted by the pagefile back. I would prefer to run my SSD drive with at least 25-30% free space (to aid in good wear leveling).

Disable System Restore

Again the first reason given why one would want to disable system restore is “to reduce the number of writes to your SSD”. Now, Windows 8 creates a restore point for you automatically during Windows Updates and when installing software packages.

By default, System Restore is set to use 3% of your hard disk space, so it is not a huge amount. Considering the (potential) benefits of System Restore, I wouldn’t disable it.

Disable Drive Indexing

Another one that always is mentioned is to disable drive indexing. The reason given?

“SSDs are speedier than hard drives and have an access time of 0.1 milli second. Drive indexing results in increasing the number of file write operations doesn’t really speed up SSD and its better to have it turned off.”

Or

“The seek times on SSD drives are so fast that you don’t need indexing.”

Indexing isn’t used in normal file-access, it is used to find files more quickly when using search. If you disable indexing you WILL get much slower search.

Minimizing Disk Space Usage

If I had a 256 GB (or larger) SSD drive I wouldn’t even bother with this. But right now most people will have to do with either a 64 GB or 128 GB drive. I have the latter size. Like I explained before, I’d like to keep 25-30% of the drive available as free space. I think this is good because it helps with endurance (wear leveling).

On page 3 of this article I list some steps you can take to minimize space usage on your system (SSD) drive.


Minimizing Disk Space Usage

If I had a 256 GB SSD drive I wouldn’t even bother with this. But right now most people will have to do with either a 64 GB or 128 GB drive. I have the latter size. Like I explained before, I’d like to keep 25-30% of the drive available as free space. I think this is good because it helps with endurance (wear leveling).

Adjust Pagefile

As I explained on the previous page, I have adjusted my pagefile to recover many GB’s of space. I set a 1GB pagefile on my C drive and a “System managed” pagefile on my D drive (a ‘normal’ hard drive). The reason for the 1GB pagefile on the C drive (System drive) is that Windows will need that when a BSOD occurres to write the dump file. I only had a few BSOD’s in the last years because of a faulty graphics card, but I’d just make the setting as I describe above so I can forget about it, and not have to wonder why I don’t get a mini dump when I run into another problem months or years down the road.

If you want to check and measure how much of your pagefile is actually used, follow these steps:

  • Press Winkey + Q and type perfmon and press [Enter]
  • Select the Performance Monitor under Monitoring Tools, right-click an empty space in the viewing window & select Add Counters from the context menu
  • Under Available Counters scroll (up) to Paging File
  • Double click Paging File and while pressing the [Ctrl] key on your keyboard, select % Usage and % Usage Peak, then click the Add >> button followed by the OK button

You’ll now have a real-time view of your pagefile usage.

For more information about Performance Monitor & how to set up (continues) data monitoring, see this Microsoft TechNet article: Overview of Windows Performance Monitor.

If you would like to verify the absence (or existence) of a pagefile.sys file (and check the size at the same time), type this command at a command prompt: dir c:\ /as.

If you check for system files (using the command dir c:\ /as) you will notice that Windows 8 has both apagefile.sys and a swapfile.sys. The swapfile.sys is a swapfile used for the new “modern” Windows apps (“Metro” Apps), and is normally 256 MB in size.

I have personally adjusted my pagefile to 1GB on my C drive & a “System managed” pagefile on my D drive(Figure)Pagefile settings.

Corsair Neutron Series GTX 120GB (6Gb/s) SATA 3 Exclusive L LM87800 Toggle SSD (CSSD-N120GBGTX-BK)

Disable Hibernate

If you are looking to free up space on your SSD drive, you could disable the Hibernate function. Most people never use this (especially on desktop computers), but hibernate is set up by default. When you use the Windows settings to disable hibernation, the actual file that is used to hold the contends of your memory (hiberfil.sys) is not removed. To remove this file, open an elevated command prompt (type CMD on Windows 8 Start screen, right-click the Command Promptapp and click Run as administrator from the menu(Figure)Run as administrator) and type the following command: powercfg -h off and press [Enter] (there is no confirmation in the command window, but it will delete your hiberfil.sys file). The default (size) setting for Hiberfil.sys is 75% of your RAM (in my case 19.1 GB of wasted space!).

If you would like to verify the absence (or existence) of a hiberfil.sys file (and check the size at the same time), type this command at a command prompt: dir c:\ /as.

I have personally removed my hiberfil.sys file (I’m running on a desktop and never use hibernate).

One important thing you need to know when you disable hibernate in Windows 8 you also disable Fast Startup. Windows 8 introduced a new feature called Fast Startup that is enabled by default in Windows 8. Fast Startup is a hybrid of traditional cold boot and resuming from hibernate. When you “shut down” Windows 8, the OS closes the user sessions, but instead of closing the kernel session, it is hibernated.

Compared to a full hibernate, which includes a lot of memory pages in use by apps, session 0 (the system session) hibernation data is much smaller, which takes substantially less time to write to disk. According to Microsoft, using this technique gives a significant advantage for boot times, since reading the hiberfile and reinitializing drivers is much faster on most systems (30-70% faster on most systems tested).

Personally I don’t care about Fast Startup on my desktop PC. While my desktop PC is an older (2009) model using a traditional BIOS (which loads slower than the newer UEFI (Unified Extensible Firmware Interface) BIOS replacement), I only start/shut down my PC once or twice daily so a 7-10 second difference (I tested it) doesn’t mean anything for me. But it might be important for you, especially on a portable (Laptop/Netbook) PC.

Move your “Documents” folder

The easy way to do this is to just create a new folder on your non-SSD drive. Launch Windows Explorer, and on the left side, right-click the Documents listing below Libraries*) and select Properties. In the properties window you’ll see the two default locations listed (Figure)Documents Library. Click the Add button and browse to the new folder you just created, select it, and click the Include folder button. Once you have done this, you can right-click the new listing and selectSet as default save location.

*) In Windows 8.1 Libraries are not displayed by default in Windows Explorer. To display these, open Windows Explorer, and on the menu click View. Next click on the Navigation pane button and select Show libraries(Figure)Show Libraries.

If you want, you can now move any files you have in the old location to the new one then just select the old listing from the Library Properties window and press the Remove button. The folder will still be there, but any file that you save to Documents will in fact save to the new location on your 2nd hard drive.

You can do this with all Libraries, and you can add your own.

I have personally moved all Libraries to my data drive (Figure)Documents Library.

Use memory cache instead of disk cache for your Web browser

In Firefox, there’s a way to write cached files to RAM instead of your hard disk. This is both faster and will reduce writes to the SSD while using the browser. Open Firefox, and in the address bar type about:config. Press Enter and in the Filter box, type browser.cache.disk.enable. Double-click the entry browser.cache.disk.enable to set the value to False.

Right-Click an empty space, and from the menu select New > Integer. Enter the valuedisk.cache.memory.capacity and press the OK button. Next enter a value for the memory capacity in KB. I had noted that my disk cache had been just below 45MB, so I decided to set a 96MB (98304) memory cache. After pressingOK, restart Firefox.

I then deleted the files from the cache folder (C:\ Users \ {User name} \ AppData \ Local \ Mozilla \ Firefox \ Profiles \ {########}.default \ Cache

Note: Internet Explorer currently does not have an option to disable disk based caching in favor of memory caching, but you can move the location of the cache (Temporary Internet Files) to a different location. This gives you two options: One, use a separate way to establish a memory cache & redirect IE’s TIF there. Two: Relocate the TIF files off your SSD drive, onto a secondary (Internal or external) drive.

Since I have a large amount of memory (24 GB), I use Dataram’s RAMDisk to create a 512 MB RAM disk where I have re-directed Internet Explorer’s Temporary Internet Files (Figure)Internet Explorer's Temporary Internet Files.

Personally I have set RAMDisk to load an “empty” disk image on re-boot, but if you want you can set the software to write the contents to a disk file on shutdown which can be reloaded in memory on a new (Windows) start. I just like to get rid of Internet Explorer’s cache on every new startup.

As indicated above, I have personally set Firefox to use a memory based cache & use a custom memory based “drive” for Internet Explorer’s cache.

Move Windows Indexing Data

Yea, I know, Windows Search hasn’t the best reputation… so some people like to disable it altogether. If you want to disable it, be my guest. My reason for not disabling it is that I like to use the search function (by typing something in the Start Search box* quite frequently. 60-70% of the time I find what I’m looking for. If not, then I launch my copy ofAgent Ransack, but that’s a bit more ‘work’. I did move the search index related files off my SSD (Figure)Search Index Location.

*) Yes, I do have a Start Search box in Windows 8. I use a Start Menu replacement, see my article Missing the Start Menu in Windows 8?

If you have further questions or suggestions I suggest posting a message on our Forum.