CHKDSK

(from Check Disk)

CHKDSK - Checks a disk and displays a status report.

CHKDSK [drive:][[path]filename] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]] [/B] [/option [...]]

Where:

  • drive: - Specifies the drive (followed by a colon :).
  • path - Specifies the path to the file.
  • filename - FAT only: Specifies the files to check for fragmentation.
  • /F - Fix disk errors.
  • /V - On NTFS: Displays any cleanup messages. On FAT/FAT32: Displays the full path and name of each file on the disk.
  • /R - Detect bad sectors and recover readable information (requires /F option).
  • /L:size - NTFS only: Changes the log file size to the specified value in KB. If no value is specified, displays the current size.
  • /X - Forces the volume to be unmounted if necessary. All handles to the volume would then be invalid (/F option required).
  • /I - NTFS only: Performs a less thorough check of index entries.
  • /C - NTFS only: Skips checking for cycles within directory structures.
  • /option [...] - Allows you to add additional options (introduced in newer versions of Windows):
    • /SCAN - NTFS only: Performs an online scan of the volume.
    • /FORCEOFFLINEFIX - NTFS only: (use with /SCAN) Skips online recovery; all detected defects are queued for offline recovery (performed via CHKDSK /SPOTFIX).
    • /PERF - NTFS only: (use with /SCAN) Uses more system resources to perform the scan as quickly as possible. May adversely affect the performance of other tasks on the system.
    • /SPOTFIX - NTFS only: Performs a spot fix of the volume.
    • /SDCLEANUP - NTFS only: Garbage collects unnecessary security descriptor data (implies /F).
    • /OFFLINESCANANDFIX - NTFS only: Performs offline analysis and repair of the volume.
    • /FREEORPHANEDCHAINS - FAT/FAT32/exFAT only: Frees any orphaned cluster chains instead of recovering their contents.
    • /MARKCLEAN - FAT/FAT32/exFAT only: Marks the volume as clean if no corruption is found, even if /F is not specified.

NB: FAT, FAT32 and NTFS are different types of file systems. The /I and /C options can be used to reduce disk analysis and checking times.

Examples:

1. Detect bad sectors and recover readable information and fixes disk errors and, if necessary, force dismount the volume in drive J:

chkdsk J: /f /r /x

 

2. Fix disk errors, change the size of the registry file to 99 KB, and perform a less thorough check of index entries in the file K:\Cool_virus\virus n_341.bat:

chkdsk "K:\Cool_virus\virus n_341.bat" /f /l:99 /i

Comments