fortypoundhead.com

chkdsk.exe

Posted On 2005-11-1 by FortyPoundHead
Keywords: Command Reference
Tags: Windows Commandline Windows
Views: 1661


chkdsk.exe

Check Disk - check and repair disk problems



syntax

      CHKDSK [drive:][[path]filename] [/F] [/V] [/R] [/L[:size]]



key

   [drive:]   Specify the drive to check.

  

   filename   Specify the file(s) to check for fragmentation (FAT only).

  

   /F         Automatically Fix file system errors on the disk.

  

   /R         Scan for and attempt Recovery of bad sectors.

  

   /V         Display the full path and name of every file on the disk.

  

   /L:size    NTFS only: change the log file size to the specified number of

  kilobytes.  If size is not specified, displays the current log size and

  the drive type (FAT or NTFS).



   /C         Skip directory corruption checks.



   /I         Skip corruption checks that compare directory entries to the

              file record segment (FRS) in the volume's master file table (MFT)



For example:



CHKDSK c: /F



Fixing Errors /F

If the drive is the boot partition for NT, you will be prompted to run the check during the next boot.  To issue chkdsk on a hard drive you must be a member of the Administrators group.  If you specify the /f switch, chkdsk will show an error if open files are found on the disk.



If you use chkdsk /f on a very large disk or a disk with a very large number of files (millions), chkdsk may take a long time to complete. The computer will not be available during this time, as chkdsk does not relinquish control until it is done.



Scanning only (without the /f switch)

If a file needs to be fixed chkdsk will alerts you with a message but will not fix the error(s).  Chkdsk may report lost allocation units on the disk - it will produce this report even if the files are in-use (open). If corruption is found, consider closing all files and repairing the disk with /F. Often the easiest method (even for non-primary partition drives) is to run the scan during bootup.



Cluster (or block) Size

CHKDSK produces a report that shows the the block /cluster size

typically:



"4096 bytes in each allocation unit."



Exit codes

0 No errors were found

1 Errors were found and fixed.

2 Could not check the disk, did not or could not fix errors.



Notes:

It is possible to run CHKDSK on a live system (as long as /f is not specified), a good strategy is to schedule an AT job to detect any disk problems by running CHKDSK >LogFileOfErrors.txt - then check the log files and manually fix any problems only as they occur.



When CHKDSK is set to run at boot-up there is a delay to allow the check to be cancelled - this can be configured in the registry:



HKLM\System\CurrentControlSet\Control\Session Manager

REG_DWORD:AutoChkTimeOutData



The value is the time in seconds that you want CHKDSK to wait (0 = no delay) default is 10 seconds.




About the Author

FortyPoundHead has posted a total of 1974 articles.

 


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:107.22.30.231

Before you can post, you need to prove you are human. If you log in, this test goes away.



Recent Forum Posts

List of Shady Characters
dwirch posted on April 25, 2017 at about 16:39 in Webmaster Stuff

Job Spammer: Bilal Uddin
dwirch posted on April 25, 2017 at about 11:00 in Spammers

Bug Fix: Contact Form Error
dwirch posted on April 21, 2017 at about 11:38 in Site News

Bug Fix: Ophion Time Tracker
dwirch posted on April 9, 2017 at about 11:30 in Site News

Job Spammer: Yogesh Kapadne
dwirch posted on March 31, 2017 at about 8:04 in Spammers

Job Spammer: Sathya Narayana
dwirch posted on March 15, 2017 at about 7:18 in Spammers