Disk problems can cause
unpredictable behavior in Windows. First, disk problems can lead to
corrupted files because important system files and drivers are stored on
your hard disk. Second, disk problems can lead to corruption in the
page file or temporary files. Third, low disk space can lead to failed
attempts to allocate disk space for temporary files. Any of these types
of problems can cause unpredictable behavior. As a result, one step in troubleshooting
hardware problems should be to check for disk problems and free up
available disk space. Additionally, if you have a hard disk with
nonvolatile caching, you can disable nonvolatile caching to determine
whether the cache is causing problems.
1. How to Prepare for Disk Failures
You can take several steps to
prepare yourself—and your computers—for troubleshooting disk problems
before the problems occur. First, familiarize yourself with recovery and
troubleshooting tools. Use of disk redundancy lessens the impact of
hardware failures. Backups ensure minimized data loss when failures
occur. Protect yourself from malicious attacks by using antivirus
software. Finally, perform regular maintenance on your storage devices.
You should familiarize
yourself with the System Recovery tools and have a Windows DVD available
to start the tools if the hard disks are not available.
Run ChkDsk /f /r regularly to
fix file system problems that may appear because of faulty hardware,
power failures, or software errors. Schedule downtime to reboot the
computer and allow Autochk to resolve problems on boot and system
volumes. Regularly review the ChkDsk output and the event log to
identify problems that ChkDsk cannot fix.
For desktop computers that store critical, constantly updated data, use hardware disk
redundancy (also known as RAID) to allow computers to continue to
function if a hard disk fails. Keep replacement disks on hand.
At a minimum, back up
critical files nightly. Redundancy does not eliminate the need for
backups. Even redundant file systems can fail, and disk redundancy
cannot protect against files that are corrupted by an application. You
must restore corrupted files from an archival backup created before the
corruption occurred.
Viruses, spyware,
and other types of malware are a significant source of disk and file
system problems. Follow these guidelines to avoid infecting computers
with viruses:
Install a virus detection program. Configure the virus detection program to automatically retrieve updated virus signatures.
Use Windows Update to ensure that operating system files stay up to date.
Keep
applications up to date, especially Web browsers, which malware often
abuses to install unwanted software. Windows Update distributes updates
for Internet Explorer.
Never run untrusted scripts or applications.
Use Windows AppLocker to prevent users from running nonapproved software.
Although fragmentation will not
cause a hard disk to fail, it will cause performance problems. To avoid
performance problems, schedule the Defrag command-line tool to run
regularly during off-peak hours. Store the output of the Defrag tool to a
text file and review that text file regularly to ensure that
defragmentation is performing as expected. To further minimize problems
caused by fragmentation, ensure that all volumes have at least 15
percent free space available.
2. How to Use ChkDsk
ChkDsk (ChkDsk.exe) is a
command-line tool that checks disk volumes for problems and attempts to
repair any that it finds. For example, ChkDsk can repair problems
related to bad sectors, lost clusters, cross-linked files, and directory
errors. Disk errors are a common source of difficult-to-track problems,
and ChkDsk should be one of the first tools you use when troubleshooting
problems that do not appear to be the result of a recent system change.
You must be logged on as an administrator or a member of the
Administrators group to use ChkDsk.
Before running ChkDsk, be aware of the following:
ChkDsk requires
exclusive access to a volume while it is running. ChkDsk might display a
prompt asking whether you want to check the disk the next time you
restart your computer.
ChkDsk might take a long time to run, depending on the number of files and folders, the size of the volume, disk performance, and available system resources (such as processor and memory).
ChkDsk might not accurately report information in read-only mode.
2.1. ChkDsk Examples
To correct disk errors from a command line, open an administrative command prompt and type
Chkdsk DriveLetter: /f /r
For example, to check drive C for errors, type
Chkdsk C: /f /r
If you need to run ChkDsk on a large D volume and you want ChkDsk to complete as quickly as possible, type
Chkdsk D: /f /c /i
2.2. ChkDsk Syntax
The command-line syntax for ChkDsk is
Chkdsk [volume[[path] filename]] [/f] [/v] [/r] [/x] [/i] [/c] [/b] [/l[:size]]
Table 1 lists all ChkDsk command-line parameters. Unless otherwise noted, parameters apply to any file system type.
Table 1. ChkDsk Parameters
PARAMETER | DESCRIPTION |
---|
volume | Specifies
the volume that you want ChkDsk to check. You can specify the volume by
using any of the formats in the following examples:
To run ChkDsk on the C volume, specify
c:
To run ChkDsk on a mounted volume called data that is mounted on the C volume, specify
c:\data
To run ChkDsk on a volume, you can specify the symbolic link name for a volume, such as
\\?\Volume{109d05a2-6914-11d7-a037-806e6f6e6963}\
You can determine a symbolic link name for a volume by using the mountvol command. |
path | FAT/FAT32 only. Specifies the location of a file or set of files within the folder structure of the volume. |
filename | FAT/FAT32 only. Specifies the file or set of files to check for <a ID="wPopUp" HREF="HELP=glossary.hlp TOPIC=gls_fragmentation"> fragmentation </a>. Wildcard characters (* and ?) are allowed. |
/f | Fixes errors on the disk.
The volume must be locked. If ChkDsk cannot lock the volume, ChkDsk
offers to check it the next time the computer restarts. |
/v | On
FAT/FAT32: Displays the full path and name of every file on the disk.
On NTFS: Displays additional information or cleanup messages, if any. |
/r | Locates <a ID="wPopUp" HREF="HELP=glossary.hlp TOPIC=glos_glo_cigj">bad sectors </a> and recovers readable information (implies /f).
If ChkDsk cannot lock the volume, it offers to check it the next time
the computer starts.
Because NTFS also identifies and remaps bad sectors during the course of
normal operations, it is usually not necessary to use the /r parameter unless you suspect that a disk has bad sectors. |
/x | Forces the volume to dismount first, if necessary. All opened handles to the volume are then invalid (implies /f). This parameter does not work on the boot volume. You must restart the computer to dismount the boot volume. |
/i | NTFS only. Performs a less-detailed check of index entries, reducing the amount of time needed to run ChkDsk. |
/c | NTFS only. Skips the checking of cycles within the folder structure, reducing the amount of time needed to run ChkDsk. |
/l:size | NTFS
only. Changes the size of the log file to the specified number of
kilobytes. Displays the current size if you do not enter a new size.
If the system loses power, stops responding, or is restarted
unexpectedly, NTFS runs a recovery procedure when Windows restarts. This
procedure accesses information stored in this log file. The size of the
log file depends on the size of the volume. In most conditions, you do
not need to change the size of the log file. However, if the number of
changes to the volume is so great that NTFS fills the log before all
metadata is written to disk, then NTFS must force the metadata to disk
and free the log space. When this condition occurs, you might notice
that Windows stops responding for 5 seconds or longer. You can eliminate
the performance impact of forcing the metadata to disk by increasing
the size of the log file. |
/b | NTFS
only. Re-evaluates bad clusters on the volume. This is typically not
necessary, but it might allow you to reclaim some lost disk space on a
hard disk with a large number of bad clusters. However, these clusters
might experience problems in the future, decreasing reliability. |
/? | Displays information about using ChkDsk. |
2.3. How to Use the Graphical ChkDsk Interface
In addition to using the
command-line version of ChkDsk, you can run ChkDsk from My Computer or
Windows Explorer by following these steps:
Click Start and then click Computer.
Right-click the volume you want to check and then click Properties.
Click the Tools tab and then click Check Now.
Do one of the following:
To run ChkDsk in read-only mode, clear all check boxes and then click Start.
To
repair errors without scanning the volume for bad sectors, select the
Automatically Fix File System Errors check box and then click Start.
To
repair errors, locate bad sectors, and recover readable information,
select both the Automatically Fix File System Errors and Scan For And
Attempt Recovery Of Bad Sectors check boxes and then click Start.
ChkDsk will run
immediately if the volume is not in use and then display the results in a
dialog box. If the volume is in use, ChkDsk will request that you
schedule a disk check for the next time the computer is restarted.
2.4. How to Determine Whether ChkDsk Is Scheduled to Run
Windows might also configure ChkDsk to run automatically at startup if it detects problems
with a volume. Volumes that Windows determines need to be checked are
considered dirty. To determine whether a volume is considered dirty, run
the following command at a command prompt.
Chkntfs volume:
For example, to determine whether drive C is considered dirty, run the following.
Chkntfs C:
You can also use the Chkntfs
tool to prevent a dirty volume from being checked at startup, which is
useful if you want to avoid the time-consuming ChkDsk process and will
not be at the computer during startup to bypass ChkDsk. For more
information, run the following at a command prompt.
Chkntfs /?
2.5. ChkDsk Process on NTFS Volumes
When you run ChkDsk on NTFS
volumes, the ChkDsk process consists of three major stages and two
optional stages. ChkDsk displays its progress for each stage with the
following messages.
Windows is verifying files (stage 1 of 5)...
File verification completed.
CHKDSK is verifying indexes (stage 2 of 5)...
Index verification completed.
CHKDSK is verifying security descriptors (stage 3 of 5)...
Security descriptor verification completed.
CHKDSK is verifying file data (stage 4 of 5)...
File data verification completed.
CHKDSK is verifying free space (stage 5 of 5)...
Free space verification completed.
The following list describes each of the ChkDsk stages.
Stage 1: ChkDsk verifies each file record segment in the Master File Table
During stage 1, ChkDsk examines each file record segment in the
volume's Master File Table (MFT). A specific file record segment in the
MFT uniquely identifies every file and directory on an NTFS volume. The percentage complete that ChkDsk displays during this phase is the percentage of the MFT that has been verified.
The
percentage complete indicator advances relatively smoothly throughout
this phase, although some unevenness might occur. For example, file
record segments that are not in use require less time to process than do
those that are in use, and larger security descriptors take more time
to process than do smaller ones. Overall, the percentage complete
indicator is a fairly accurate representation of the actual time
required for that phase.
Stage 2: ChkDsk checks the directories in the volume
During stage 2, ChkDsk examines each of the indexes (directories) on
the volume for internal consistency and verifies that every file and
directory represented by a file record segment in the MFT is referenced
by at least one directory. ChkDsk also confirms that every file or
subdirectory referenced in each directory actually exists as a valid
file record segment in the MFT and checks for circular directory
references. ChkDsk then confirms that the timestamps and the file size
information associated with files are up to date in the directory
listings for those files.
The
percentage complete that ChkDsk displays during this phase is the
percentage of the total number of files on the volume that are checked.
For volumes with many thousands of files and folders, the time required
to complete this stage can be significant.
The
duration of stage 2 varies because the amount of time required to
process a directory is closely tied to the number of files or
subdirectories listed in that directory. Because of this dependency, the
percentage complete indicator might not advance smoothly during stage
2, though the indicator continues to advance even for large directories.
Therefore, do not use the percentage complete indicator as a reliable
representation of the actual time remaining for this phase.
Stage 3: ChkDsk verifies the security descriptors for each volume
During stage 3, ChkDsk examines each of the security descriptors
associated with each file and directory on the volume by verifying that
each security descriptor structure is well formed and internally
consistent. The percentage complete that ChkDsk displays during this
phase is the percentage of the number of files and directories on the
volume that are checked.
The percentage complete indicator advances relatively smoothly throughout this phase, although some unevenness might occur.
Stage 4: ChkDsk verifies file data During stage 4 (which is optional), ChkDsk verifies all clusters in use. ChkDsk performs stages 4 and 5 if you specify the /r parameter when you run ChkDsk. The /r parameter confirms that the sectors in each cluster are usable. Specifying the /r parameter is usually not necessary, because NTFS identifies and remaps bad sectors during the course of normal operations, but you can use the /r parameter if you suspect the disk has bad sectors.
The
percentage complete that ChkDsk displays during stage 4 is based on the
percentage of used clusters that are checked. Used clusters typically
take longer to check than unused clusters, so stage 4 lasts longer than
stage 5 on a volume with equal numbers of used and unused clusters. For a
volume with mostly unused clusters, stage 5 takes longer than stage 4.
Stage 5: ChkDsk verifies free space During stage 5 (which is optional), ChkDsk verifies unused clusters. ChkDsk performs stage 5 only if you specify the /r
parameter when you run ChkDsk. The percentage complete that ChkDsk
displays during stage 5 is the percentage of unused clusters that are
checked.
3. How to Use the Disk Cleanup Wizard
With Disk Cleanup
(Cleanmgr.exe), you can delete unneeded files and compress infrequently
accessed files. This tool is primarily useful for resolving problems
that might be related to a shortage of disk space. Insufficient free
disk space can cause many problems, ranging from Stop errors to file
corruption. To increase free space, you can do the following:
To run Disk Cleanup, follow these steps:
Click Start and then click Computer.
Right-click
the drive you want to clean and then select Properties. On the General
tab of the Properties dialog box, click Disk Cleanup.
If prompted, click either My Files Only or Files From All Users On This Computer.
On the Disk Cleanup tab, select the files to delete and then click OK.
4. How to Disable Nonvolatile Caching
Windows Vista is the first Windows operating system to support caching hard disk
data to a nonvolatile cache on hard disks with the required cache.
Windows Vista and Windows 7 can use the cache to improve startup
performance, improve the performance of frequently modified system data,
and reduce utilization. In rare circumstances, the failing nonvolatile
cache might cause problems.
To eliminate the possibility that the nonvolatile cache is causing
problems, you can disable different cache functionality using the
following Group Policy settings (located in Computer
Configuration\Administrative Templates\System\Disk NV Cache):
Turn Off Boot And Resume Optimizations Enable this policy to prevent Windows from using the nonvolatile cache to speed startup times.
Turn Off Cache Power Mode
Enable this policy to prevent Windows from putting disks into a
nonvolatile cache power-saving mode, which enables the hard disk to spin
down while continuing to use the nonvolatile cache.
Turn Off Non Volatile Cache Feature Enable this policy to completely disable all use of the nonvolatile cache.
Turn Off Solid State Mode
Enable this policy to prevent frequently written files such as the
system metadata and registry from being stored in the nonvolatile cache.