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.
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).
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 (http://raxco.com/, shown in Figure 3). It's not free, but there's a time-limited demo on the Raxco web site.
There's not a whole lot in the way of free defragmenters, but Auslogics Registry Defrag (http://www.auslogics.com/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.
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:
Open the Registry Editor .
Expand the branches to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction.
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:.
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.)