A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/windows-server/administration/windows-commands/CHKDSK below:

chkdsk | Microsoft Learn

Checks the file system and file system metadata of a volume for logical and physical errors. If used without parameters, chkdsk displays only the status of the volume and doesn't fix any errors. If used with the /f, /r, /x, or /b parameters, it fixes errors on the volume.

Important

Membership in the local Administrators group, or equivalent, is the minimum required to run chkdsk. To open a command prompt window as an administrator, right-click Command prompt in the Start menu, and then select Run as administrator.

Important

Interrupting chkdsk isn't recommended. However, canceling or interrupting chkdsk shouldn't leave the volume any more corrupt than it was before chkdsk was run. Running chkdsk again checks and should repair any remaining corruption on the volume.

Note

Chkdsk can be used only for local disks. The command can't be used with a local drive letter that has been redirected over the network.

Syntax
chkdsk [<volume>[[<path>]<filename>]] [/f] [/v] [/r] [/x] [/i] [/c] [/l[:<size>]] [/b] [/scan] [/forceofflinefix] [/perf] [/spotfix] [/sdcleanup] [/offlinescanandfix] [/freeorphanedchains] [/markclean] [/?]
Parameters Parameter Description <volume> Specifies the drive letter (followed by a colon), mount point, or volume name. [<path>]<filename> Use with file allocation table (FAT) and FAT32 only. Specifies the location and name of a file or set of files that you want chkdsk to check for fragmentation. You can use the wildcard characters ? and * to specify multiple files. /f Fixes errors on the disk. The disk must be locked. If chkdsk can't lock the drive, a message appears that asks you if you want to check the drive the next time you restart the computer. /v Displays the name of each file in every directory as the disk is checked. /r Locates bad sectors and recovers readable information. The disk must be locked. /r includes the functionality of /f, with the additional analysis of physical disk errors. /x Forces the volume to dismount first, if necessary. All open handles to the drive are invalidated. /x also includes the functionality of /f. /i Use with NTFS only. Performs a less vigorous check of index entries, which reduces the amount of time required to run chkdsk. /c Use with NTFS only. Doesn't check cycles within the folder structure, which reduces the amount of time required to run chkdsk. /l[:<size>] Use with NTFS only. Changes the log file size to the size you type. If you omit the size parameter, /l displays the current size. /b Use with NTFS only. Clears the list of bad clusters on the volume and rescans all allocated and free clusters for errors. /b includes the functionality of /r. Use this parameter after imaging a volume to a new hard disk drive. /scan Use with NTFS only. Runs an online scan on the volume. /forceofflinefix Use with NTFS only (must be used with /scan). Bypass all online repair; all defects found are queued for offline repair (for example, chkdsk /spotfix). /perf Use with NTFS only (must be used with /scan). Uses more system resources to complete a scan as fast as possible. This might have a negative performance impact on other tasks running on the system. /spotfix Use with NTFS only. Runs spot fixing on the volume. /sdcleanup Use with NTFS only. Garbage collect unneeded security descriptor data (implies /f). /offlinescanandfix Runs an offline scan and fix on the volume. /freeorphanedchains Use with FAT/FAT32/exFAT only. Frees any orphaned cluster chains instead of recovering their contents. /markclean Use with FAT/FAT32/exFAT only. Marks the volume clean if no corruption was detected, even if /f wasn't specified. /? Displays help at the command prompt.

Normally, on large capacity HDDs, /r or /b would take a considerable amount of time as it reads every sector. Even without errors and with a mostly empty drive, the physical read speed bottlenecks the process.

There might be cases where on large capacity HDDs where chkdsk might complete its process too quickly. If this occurs, it might be that:

Viewing the chkdsk logs might point to a potential issue during scans. To learn more, see Viewing chkdsk logs.

As sector reads are faster on SSDs, running the /r and /b parameters complete the process faster due to its physical makeup.

There might be cases where on large capacity SSDs where chkdsk might complete its process too quickly. If this occurs, it might be that:

Viewing the chkdsk logs might point to a potential issue during scans. To learn more, see Viewing chkdsk logs.

Caution

While running chkdsk on an SSD isn't dangerous, repeated full-surface scans (especially with /r) could unnecessarily increase write/erase cycles, slightly reducing the SSD lifespan. But for occasional checks, this isn't a significant concern.

Understanding exit codes

The following table lists the exit codes that chkdsk reports after it has finished.

Exit code Description 0 No errors were found. 1 Errors were found and fixed. 2 Performed disk cleanup (such as garbage collection) or didn't perform cleanup because /f was not specified. 3 Could not check the disk, errors could not be fixed, or errors were not fixed because /f was not specified. Examples

To check the disk in drive D and have Windows fix errors, type:

chkdsk d: /f

If it encounters errors, chkdsk pauses and displays messages. Chkdsk finishes by displaying a report that lists the status of the disk. You can't open any files on the specified drive until chkdsk finishes.

To check all files on a FAT disk in the current directory for noncontiguous blocks, type:

chkdsk *.*

Chkdsk displays a status report, and then lists the files that match the file specifications that have noncontiguous blocks.

Viewing chkdsk logs

There are two methods that can be used to retrieve chkdsk log files in Windows, using the Event Viewer and PowerShell.

To view logs with Event Viewer, perform the following actions:

  1. Start > Control Panel > Administrative Tools > Event Viewer.

    Alternatively, press Win + R keys to bring up the run dialog box, type eventvwr.msc, and select OK.

  2. Expand Windows Logs > right-click on Application > select Filter Current Log.

  3. Within the Filter Current Log window, navigate to Event sources drop-down menu, select Chkdsk and Wininit.

  4. Select OK to finish filtering for these two sources.

There are two source types when retrieving logs in PowerShell, chkdsk and wininit. Run one of the two commands in PowerShell to view the most current chkdsk log:

get-winevent -FilterHashTable @{logname="Application"} | ?{$_.providername -match "chkdsk"} | fl timecreated, message
get-winevent -FilterHashTable @{logname="Application"} | ?{$_.providername -match "wininit"} | fl timecreated, message

To export the log to a specific location, add the following to the end of the command | out-file "$env:userprofile\location\filename.txt". Example:

get-winevent -FilterHashTable @{logname="Application"} | ?{$_.providername -match "chkdsk"} | fl timecreated, message | out-file "C:\Users\Administrator\Desktop\Chkdsk_Log.txt"
get-winevent -FilterHashTable @{logname="Application"} | ?{$_.providername -match "wininit"} | fl timecreated, message | out-file "C:\Users\Administrator\Desktop\Wininit_Log.txt"

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4