Windows Vista : Performance - Hard Disk (part 1) - A Defragmentation Crash Course

8/28/2012 1:22:47 AM
Your hard disk is more than just a storage device; it's used to hold your operating system and to supplement your system's memory. The speed and health of your hard disk is one of the most important factors in your computer's performance, not to mention its reliability and security. Yet it's also the one component that requires the most attention and often is the most neglected. Awww.

The following topics all deal with different aspects of your hard disk and how you can get Windows to use it most effectively. Later in this section, you'll find tips on upgrading and repartitioning your hard disk, to allow you to keep your disk and its data in tip-top shape.

1. A Defragmentation Crash Course

The best way to ensure maximum performance from your drive is to regularly—weekly or biweekly—defragment it (also called optimizing). Figure 1 shows how frequent use can cause files to become fragmented (broken up), which can slow access and retrieval of data on the drive, as well as increase the likelihood of lost data. And the fuller the drive, the more serious defragmentation becomes.

Figure 1. File fragmentation on your hard disk can hurt performance and decrease reliability

The good news is that Vista defragments your drives automatically; by default, it's scheduled to run at 1:00 a.m. every Wednesday morning from now until the end of time.

PC not on in the middle of the night? Defragmenter will run the next morning while you're working (when the PC is idle, anyway). Or, if you want to run it by hand, open Windows Explorer, right-click your hard disk, select Properties, choose the Tools tab, and click Defragment Now (Figure 2).

Figure 2. The only interface you'll ever see to the mysteriously disappearing Disk Defragmenter tool

Disk Defragmenter does its job by rearranging the files on your hard disk to make them contiguous (not broken into pieces). It also defragments the free space by consolidating your files as much as it can. When run automatically, it has no interface to speak of, but rather runs invisibly in the background.

Now for the bad news.

In each successive version of Windows, Microsoft has further buried Disk Defragmenter; in Vista, it's basically invisible. For most Vista users, this is a good thing, but its severely minimalist design prevents just about any advanced tasks.

For instance, there's no way to defragment the swap file (virtual memory), the hibernation file (hiberfil.sys), or any other unmovable files. There's no disk map, so you won't know if there's a large file that won't defragment. If you have more than one hard disk (or partition), there's no way to defragment all your drives in one pass unless you schedule it.

Now, to be fair, these are some pretty niche features. If you miss the map, advanced settings, or detailed reporting of the old-school defragmenters, check out PerfectDisk (, shown in Figure 3). It's not free, but there's a time-limited demo on the Raxco web site.

Figure 3. PerfectDisk provides the advanced features missing in Vista's own Disk Defragmenter

There's not a whole lot in the way of free defragmenters, but Auslogics Registry Defrag ( promises to improve Windows performance by shrinking and optimizing your Registry.

1.1. Command-line defragmenter

As it turns out, Vista's own Disk Defragmenter isn't quite as feeble as it first appears. Although it doesn't offer anything close to the usability of PerfectDisk, there is a little-known command-line version (defrag.exe) that gives you just a little more freedom than the one you access through Windows Explorer.

Open a Command Prompt window in administrator mode (right-click the Command Prompt icon in the Start menu and select Run as administrator), and then type the following at the prompt:

defrag -a -v c:

and press Enter to generate a report like the one in Figure 4.

Figure 4. Defrag.exe lets you view reports and schedule more thorough defragmenting than the Windows version

To perform a full defragmentation (the default is only a partial defrag), type:

defrag -w c:

Press Ctrl-C at any time to interrupt Defrag. Or, to perform a full defragmentation of all the drives on your PC, while forcing defragmentation on nearly full volumes that would otherwise be skipped, type:

defrag -c -w -f

For more options, type defrag -? at the prompt and press Enter.

1.2. Enable automatic boot defragments

Here's a funny little setting in the Registry that seems as though it's supposed to instruct Windows to defragment your hard disk automatically each time it starts:

  1. Open the Registry Editor .

  2. Expand the branches to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction.

  3. Double-click the Enable value, and type Y for its data (or type N to disable it).

The funny part is that this setting is probably already enabled on your system (it's enabled by default on most Vista systems). Now, have you ever seen Windows run Disk Defragmenter at startup?

The reason you don't see it is because it isn't a full defragment. Instead, it's only a boot defragment, which affects only the files registered with Windows' Prefetch feature (see the upcoming "Keeping an Eye on Prefetch" sidebar) and listed in the Layout.ini file (not a standard .ini file).

You can perform this boot defragment at any time by running the command-line Defrag tool with the undocumented -b option, like this: defrag -b c:.

Keeping an Eye on Prefetch

Prefetch is a new feature, introduced in Windows Vista, that stores specific data about the applications you run in order to help them start faster. Prefetch is an algorithm that helps anticipate cache misses (times when Windows requests data that isn't stored in the disk cache), and stores that data on the hard disk for easy retrieval.

This data is located in \Windows\Prefetch, and, as the theory goes, periodically clearing out the data in this folder (say, once a month) will improve performance. As new applications are subsequently started, new prefetch data will be created, which may mean slightly reduced performance at first. But with older entries gone, there will be less data to parse, and Windows should be able to locate the data it needs more quickly. Any performance gains you may see will be minor (if you see any at all), but those users wishing to squeeze every last CPU cycle out of their computers will want to try this one.

Note that deleting Prefetch data may increase boot time slightly, but only the next time you boot Windows. Each subsequent boot should proceed normally, since the prefetch data will already be present for the programs Windows loads when it boots.

If you want to disable Prefetch, open your Registry Editor, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters, and change the EnablePrefetcher value to 0. (Other supported values: 1 to Prefetch applications only, 2 to Prefetch boot processes, and 3 to Prefetch both.)

  •  Gaming Mouse Tt ESPOTRS Theron And Mouse Pad Ladon
  •  Windows Server 2008 and Windows Vista : Architectural Parts of a GPO (part 2) - Group Policy Container
  •  Windows Server 2008 and Windows Vista : Architectural Parts of a GPO (part 1) - Group Policy Template
  •  Windows Server 2003 : Server Clustering (part 4) - Using the Cluster Application Wizard, Configuring Failover and Failback
  •  Windows Server 2003 : Server Clustering (part 3) - Creating a New Cluster Group, Adding a Resource to a Group
  •  Windows Server 2003 : Server Clustering (part 2) - Creating a True Server Cluster, Adding a Node to an Existing Cluster
  •  Windows Server 2003 : Server Clustering (part 1) - Cluster Terminology, Types of Resources, lanning a Cluster Setup
  •  Windows XP : Participating in Internet Newsgroups - Downloading Messages
  •  Windows XP : Participating in Internet Newsgroups - Working with Newsgroups in Outlook Express
  •  Analysis Ultrabooks
  •  Farewell To Pixels : Retina MacBook Pro brings the new age of dot-free displays to OS X
  •  Computing – OS
  •  Windows Server 2003 : Protecting Network Communications with Internet Protocol Security - IPSec Basics (part 2) - Differences Between AH and ESP, Process and Procedure
  •  Windows Server 2003 : Protecting Network Communications with Internet Protocol Security - IPSec Basics (part 1) - Security Advantages of IPSec
  •  Windows Vista : Communicating with Windows Mail - Handling Incoming Messages (part 2) - Customizing the Message Columns, Setting Read Options
  •  Windows Vista : Communicating with Windows Mail - Handling Incoming Messages (part 1) - Processing Messages
  •  Windows Vista : Communicating with Windows Mail - Setting Up Mail Accounts
  •  Ultra-X P.H.D PCI2 - Solve PC Problems Easily (Part 2)
  •  Ultra-X P.H.D PCI2 - Solve PC Problems Easily (Part 1)
  •  Confessions Of An Internet Troll (Part 2)
    Top 10
    Canon PowerShot G15 12MP Digital Camera With 3-Inch LCD
    3D Printed Guns
    Dual-channel DDR3 RAM (Part 4)
    Dual-channel DDR3 RAM (Part 3)
    Dual-channel DDR3 RAM (Part 2)
    Dual-channel DDR3 RAM (Part 1)
    In-Win G7 Black Windowed Mid-Tower Case
    Starcraft II Gaming Mouse & Marauder Starcarft II Gaming Keyboard
    The Computers That Came In From The Cold (Part 2)
    Joystick Junkies - The Sim Hardware Roundup (Part 3) : Thrustmaster HOTAS Warthog, Thrustemaster TH8 RS Gear Shifter, ButtKicker Gamer 2
    Most View
    Corsair 16GB Dominator Platinum DDR3 - 2400
    SQL Server 2005 Native XML Web Services : Example Native XML Web Services Project (part 3) - Creating the Client Application
    Gigabyte U2442 V2 Ultrabook Review (Part 2)
    Turn Your Smartphone Into A Safe
    Group Test: Integrated Valve Amps $2,175-$3,000 (Part 4)
    iOS In The Studio
    Web Design: Where To Start (Part 5)
    Systems for All Budgets (Part 3) - WS 1000, Silent 1000
    Which Components Have Hit The Sweet Spot? (Part 3)
    The Best Bluetooth Keyboards (Part 2)