Sideway
output.to from Sideway
Draft for Information Only

Content

MS DOS Command: CHKDSK
  Description
  Syntax
  Parameters
  Switches
  Remarks
   Format of status reports
   Using BUFFERS with SMARTDRV.EXE
   Fixing disk errors
   Using CHKDSK with open files
   Using CHKDSK with assigned drives and networks
   Physical disk errors
   Bad disk sectors
   Cross-Linked Files
   ERRORLEVEL parameters
   Saving a CHKDSK status report to a file
  Examples

MS DOS Command: CHKDSK

Reference from Microsoft MS-DOS cmd help

Description

Checks the status of a disk and displays a status report. Can also fix disk errors.

The status report shows errors found in the MS-DOS filing system, which consists of the file allocation table and directories. CHKDSK also displays a summary of disk usage. (CHKDSK does not verify that the information in your files can be accurately read.) If errors exist on the disk, CHKDSK alerts you with a message.

Note: The ScanDisk program is the preferred method of fixing drive problems, and should be used instead of the CHKDSK /F command. For more information, see the SCANDISK command.

Syntax

CHKDSK [drive:][[path]filename] [/F] [/V]

To display the status of the disk in the current drive, use the following syntax:

CHKDSK

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 wildcards (* and ?) to specify multiple files.

Switches

/F Fixes errors on the disk. Do not use this option when running CHKDSK from other programs; for more information, see "Using CHKDSK With Open Files" in CHKDSK--Notes. In general, when fixing disk errors, use ScanDisk instead of CHKDSK.
/V Displays the name of each file in every directory as the disk is checked.

Remarks

Format of status reports

MS-DOS displays CHKDSK status reports similar to the following example:

Volume Serial Number is B1AF-AFBF

 

72,214,528 bytes total disk space

73,728 bytes in 3 hidden files

30,720 bytes in 12 directories

11,493,376 bytes in 386 user files

61,440 bytes in bad sectors

6,055,264 bytes available on disk

 

2,048 bytes in each allocation unit

35,261 total allocation units on disk

29,568 available allocation units on disk

 

655,360 total bytes memory

493,456 bytes free

Using BUFFERS with SMARTDRV.EXE

If you are using SMARTDRV.EXE, either use a smaller value for BUFFERS, or do not specify a BUFFERS command at all.

Fixing disk errors

The ScanDisk program is the preferred method of fixing disk errors. For more information, see the SCANDISK command.

If you want to use CHKDSK to fix disk errors, use the /F switch. (CHKDSK corrects disk errors only if you specify the /F switch.) CHKDSK /F displays a prompt 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 examine 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

Never use CHKDSK when files are currently open. CHKDSK is designed for use when the files on the disk are in an unchanging state -- that is, when they are not open. When a file is open, it is probably changing, and MS-DOS will update the file allocation table and the directory structure to reflect changes. Such updates are not always made immediately, and updates to the file allocation table and the directories occur at different times. If you run CHKDSK when files are open on the disk, it interprets differences between the directory structure and the file allocation tables as errors. Running CHKDSK /F when files are open can result in corruption or loss of data. Therefore, never run CHKDSK /F from another program, or when Microsoft Windows or the MS-DOS Task Swapper is running.

Using CHKDSK with assigned drives and networks

The CHKDSK command does not work on drives formed by the SUBST command. 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 physical disk errors. To identify and repair physical disk errors, use the ScanDisk program. For more information, see the SCANDISK command.

Bad disk sectors

Bad sectors reported by CHKDSK were marked as "bad" when your disk was first prepared for operation. ScanDisk and other physical disk-error correction utilities can also mark sectors as "bad." Bad sectors pose no danger.

Cross-Linked Files

CHKDSK reports a cross-linked file if two files or directories are recorded as using the same disk space. If CHKDSK finds a cross-linked file, it displays a message similar to the following:

File is cross linked on allocation unit number

Some of the information in these files or directories has been lost.

CHKDSK will not fix a cross-linked file, even if you specify the /F switch. To correct a cross-linked file, run ScanDisk. Or, to fix them manually, copy the specified files or directories elsewhere and delete the originals.

ERRORLEVEL parameters

If CHKDSK does not find any errors, it returns an ERRORLEVEL value of 0. If CHKDSK found one or more errors, it returns an ERRORLEVEL value of 255.

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

To find out how much data is stored on drive C and how much space is still free, and to check the disk for errors, type the following command:

chkdsk c:

CHKDSK pauses and displays messages if it encounters errors.

To redirect the output of CHKDSK to a file named STATUS, type the following 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 redirection to correct any errors noted in the status report.


©sideway

ID: 110700139 Last Updated: 7/21/2011 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Travel 18

Reference 79

Computer

Hardware 254

Software

Application 213

Digitization 37

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 431

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Set 1

Logic 1

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2025 Sideway . All rights reserved Disclaimers last modified on 06 September 2019