Troubleshooting Tools and Strategies

Chkdsk is a command-line tool that scans and repairs volumes on the hard disk for physical problems, such as bad blocks, and logical structure errors, such as lost clusters, cross-linked files, or directory errors.

Run Chkdsk from a command prompt rather than from Windows Explorer to see the resulting display.

Chkdsk Syntax

The command-line syntax for Chkdsk is as follows:

chkdsk [volume[[path]filename]]] [/f] [/v] [/r] [/x] [/i] [/c]

[/l[:size]]

Used without parameters, Chkdsk displays the status of the disk in the current volume.

Chkdsk Switches

Table 31.7 lists all Chkdsk command-line switches.

Table 31.7 Chkdsk Switches

Switch

Effect

filename

FAT only. Specifies the file or set of files to check for fragmentation. Wildcard characters (* and ?) are allowed.

path

FAT only. Specifies the location of a file or set of files within the folder structure of the volume.

size

NTFS only. Changes the log file size to the specified number of kilobytes. Must be used with the /l switch.

volume

FAT only. Specifies the drive letter (followed by a colon), mount point, or volume name.

/c

NTFS only. Skips checking of cycles within the folder structure.

/f

Fixes errors on the volume. The volume must be locked. If Chkdsk cannot lock the volume, it offers to check it the next time the computer starts.

/i

NTFS only. Performs a less vigorous check of index entries.

/l

NTFS only. Displays current size of the log file.

/r

Locates bad sectors and recovers readable information (implies /f ). If Chkdsk cannot lock the volume, it offers to check it the next time the computer starts.

/v

On FAT. Displays the full path and name of every file on the volume.
On NTFS. Displays cleanup messages, if any.

/x

NTFS only. Forces the volume to dismount first, if necessary. All opened handles to the volume are then invalid (implies /f ).

/?

Displays this list of Chkdsk switches.

note-icon

Note

FAT refers to volumes formatted with FAT12, FAT16, or FAT32.

Using the /i or /c switch skips certain checks of the NTFS volume and reduces the amount of time required to run Chkdsk.

Use Chkdsk occasionally on each volume to check for errors. You must be logged on as a member of the Administrators group.

Chkdsk Reports

Chkdsk creates and displays a status report for a volume, based on the file system used. Chkdsk also lists and corrects errors on the volume.

The following are sample Chkdsk reports for volumes using each hard disk file system supported by Windows 2000. Each of these tests were run using the /f switch, although no errors were reported on any of the volumes.

Following is an example Chkdsk report from an NTFS volume:

The type of the file system is NTFS.

CHKDSK is verifying files (stage 1 of 3)...

File verification completed.

CHKDSK is verifying indexes (stage 2 of 3)...

Index verification completed.

CHKDSK is verifying security descriptors (stage 3 of 3)...

Security descriptor verification completed.

Windows has checked the file system and found no problem.

4096543 KB total disk space.

639500 KB in 3206 files.

692 KB in 113 indexes.

0 KB in bad sectors.

26427 KB in use by the system.

22544 KB occupied by the log file.

3429924 KB available on disk.

4096 bytes in each allocation unit.

1024135 total allocation units on disk.

857481 allocation units available on disk.

An example of a Chkdsk report from a FAT32 volume:

The type of the file system is FAT32.

Volume FAT32 created 8/7/1999 11:19 AM

Volume Serial Number is 1067-3B1C

Windows is verifying files and folders...

File and folder verification is complete.

Windows has checked the file system and found no problem.

2,618,732,544 bytes total disk space.

286,720 bytes in 29 hidden files.

401,408 bytes in 86 folders.

307,101,696 bytes in 2,179 files.

2,310,938,624 bytes available on disk.

4,096 bytes in each allocation unit.

639,339 total allocation units on disk.

564,194 allocation units available on disk.

An example of a Chkdsk report from a FAT16 volume:

The type of the file system is FAT.

Volume FAT16 created 8/7/1999 11:23 AM

Volume Serial Number is 0CE5-DBB4

Windows is verifying files and folders...

File and folder verification is complete.

Windows has checked the file system and found no problem.

1,340,538,880 bytes total disk space.

1,933,312 bytes in 50 hidden files.

3,407,872 bytes in 103 folders.

705,921,024 bytes in 3,158 files.

629,276,672 bytes available on disk.

32,768 bytes in each allocation unit.

40,910 total allocation units on disk.

19,204 allocation units available on disk.

note-icon

Note

A sample Chkdsk report from FAT12 is not shown because it is only supported on floppy disks and volumes less than 16 MB in size.

Chkdsk only runs on local floppy disks, hard disks, and removable, read/writable disks. It does not support CD-ROM and DVD-ROM disks.

If errors exist on the volume, Chkdsk alerts you by using a message and, if the /f switch was used, corrects the errors.

Correcting Problems by Using Chkdsk

Chkdsk cannot correct found errors when there are open files on the volume because Chkdsk cannot lock the volume. In this case, Chkdsk offers to check the volume automatically the next time the computer is started. This is typical behavior for the boot volume. When the boot volume is checked, the computer is automatically restarted after the volume check is completed.

Because some repairs, such as correcting lost clusters (also knows as allocation units) or cross-linked files, change a volume's file allocation table and can cause data loss, Chkdsk first prompts you with a confirmation message similar to the following:

10 lost allocation units found in 3 chains.

Convert lost chains to files?

If you press N, Windows 2000 fixes the errors on the volume but does not save the contents of the lost clusters. If you press Y, Windows 2000 attempts to identify the folder to which they belong. If the folder is identified, the lost cluster chains are saved there as files. If the folder cannot be identified or if the folder does not exist, it saves each chain of lost clusters in a folder called Found. xxx , where xxx is a sequential number starting with 000. If no folder Found.000 exists, one is created at the root. If one or more sequential folders called Found. xxx (starting at 000) exists, one using the next number in the sequence is created.

After the storage folder has been identified or created, one or more files with a name in the format File nnnn .chk (the first saved file is named File0000.chk, the second is named File0001.chk, and so on in sequence) are saved. When Chkdsk finishes, you can examine the contents of these files with a text editor to see whether they contain any needed data (if the converted chains came from corrupted binary files, they are of no value). You can delete the CHK files after you have saved any useful data.

note-icon

Note

Be careful to delete only files using the file name extension CHK from the Found. xxx folders. Other programs might create and use files with that extension.

If you do not use the /f switch, Chkdsk alerts you if it detects a file that needs to be fixed by indicating that it needs to be rerun with the /f switch to fix the errors.

If you use the /f switch on an extremely large volume (for example, 70 GB) or a volume with a very large number of files (in the millions), Chkdsk can take a long time (perhaps days) to complete. The volume is not available during this time, since Chkdsk does not relinquish control until it is done. If the system volume is being checked during the startup process, the computer is not be available until the Chkdsk process is complete.

Bad sectors reported by Chkdsk were marked when your volume was first prepared for operation. The fact that they are marked as bad means that the system prevents the disk from using them, so previously identified bad sectors pose no danger to your data.