chkdsk(CMD) 19 June 1992 chkdsk(CMD) Name chkdsk - create and display a status report for a disk Syntax chkdsk [drive:] [[path]filename] [/f] [/v] To display the status of the disk in the current drive, use the following syntax: chkdsk Description The status report shows logical errors found in the file allocation table and file system. If errors exist on the disk, chkdsk alerts you with a message. You should use chkdsk occasionally on each disk to check for errors. Parameters drive: Specifies the drive that contains the disk that you want chkdsk to check. [path]filename Specifies the location and name of a file or set of files that you want chkdsk to check for fragmentation. You can use wild- cards (* and ?) to specify multiple files. Switches /f Fixes errors on the disk. /v Displays the name of each file in every directory as the disk is checked. Notes Format of status reports MS-DOS displays chkdsk status reports in the following format: Volume Serial Number is B1AF-AFBF 72214528 bytes total disk space 73728 bytes in 3 hidden files 30720 bytes in 12 directories 11493376 bytes in 386 user files 61440 bytes in bad sectors 60555264 bytes available on disk 2048 bytes in each allocation unit 35261 total allocation units on disk 29568 available allocation units on disk 655360 total bytes memory 493456 bytes free Fixing disk errors The chkdsk command corrects disk errors only if you specify the /f switch. Since repairs usually change a disk's file allocation table and sometimes cause loss of data, chkdsk first prompts you with a confirma- tion message similar to the following: 10 lost allocation units found in 3 chains. Convert lost chains to files? If you press Y, MS-DOS saves each lost chain in the root directory as a file with a name in the format FILEnnnn.CHK. When chkdsk finishes, you can check these files to see if they contain any data you need. If you press N, MS-DOS fixes the disk but does not save the contents of the lost allocation units. If you do not use the /f switch, chkdsk alerts you with a message if a file needs to be fixed but does not fix the error(s). Using chkdsk with open files If you specify the /f switch, chkdsk shows an error if open files are found on the disk. If you do not specify the /f switch and open files exist, chkdsk might report lost allocation units on the disk. This could happen if open files have not yet been recorded in the file allocation table. If chkdsk reports the loss of a large number of allocation units, consider repairing the disk. To avoid problems caused by open files, avoid using chkdsk from another program or from an MS-DOS command inter- preter started from Microsoft Windows. Using chkdsk with assigned drives and networks The chkdsk command does not work on drives formed by the subst, join, or assign commands. You cannot use chkdsk to check a disk on a network drive. Physical disk errors The chkdsk command finds only logical errors in the file system, not phy- sical disk errors. For information about recovering physically damaged files, see the recover(CMD) command. Bad disk sectors Bad sectors reported by chkdsk were marked as ``bad'' when your disk was first prepared for operation. They pose no danger. Saving a chkdsk status report to a file You can save a chkdsk status report by redirecting the output to a file. Do not use the /f switch when you redirect chkdsk output to a file. Examples If you want to check the disk in drive A and have MS-DOS fix any errors encountered, type the following command: chkdsk a: /f chkdsk pauses and displays messages if it encounters errors. Then chkdsk prompts you to specify whether you want MS-DOS to correct the errors. chkdsk finishes by displaying a report showing the status of the disk. To redirect the output of chkdsk to a file named STATUS, type the follow- ing command: chkdsk a: > status Because the output is redirected, MS-DOS does not repair errors it encounters during the check; but it records all the errors in a report file. Afterward, you can use chkdsk with the /f switch without redirec- tion to correct any errors noted in the status report.