If you encounter any system issues on Windows and browse the internet for fixes, people will suggest you use DISM, SFC, or CHKDSK tools. While all these utilities are used to repair system corruption in Windows, they target different types of corruption—SFC repairs corrupted system files, DISM repairs Windows Image, and CHKDSK fixes errors with the disk.
So, you might want to know more about them to determine if they work or not. We’ll talk about these utilities in detail in the later sections. And, we’ll also provide you with suggestions on when you should choose a particular one.
System File Checker (SFC)
The System File Checker is the most common Windows utility used to scan for any corrupted system files and repair them. SFC works together with the Windows Resource Protection (WRP) feature and uses the Component Store (WinSxS folder inside the Windows folder) to perform the repairs.
The component store tracks the system files, directories, registry keys, and services and helps in the restoration of any corruption or boot failures in the system files.
When you run SFC, WRP checks whether the system files are in the correct location. It also checks whether the files have the correct hash encryption by comparing them and hard links with the COMPONENTS (hidden) registry hive data.
If it detects any integrity violation, it uses the files inside WinSxS or WinSxS/Backup to replace the files and restore any broken hard links.
So, you should run SFC whenever you encounter any system issues. Basically, if any protected files like drivers, default programs and tools, or services don’t work, it is recommended to run SFC.
How to Run SFC?
You can use the Elevated Command Prompt to run the System File Checker.
- Open Run by pressing Win + R.
- Type
cmd
and press Ctrl + Shift + Enter to open the Elevated Command Prompt. - To scan all protected system files without performing any repairs, enter the command
sfc /verifyonly
. - If it shows “Windows Resource Protection found integrity violations”, you can run the SFC command to repair the corrupted files,
sfc /scannow
- You can also run
sfc /scannow
directly (without running the/verifyonly
command) as it also integrates the other command, and they take the same time if there is no corruption.
After running the sfc /scannow command, you can get one of three results:
- Windows Resource Protection did not find any integrity violations.
- Windows Resource Protection found corrupt files and successfully repaired them.
- Windows Resource Protection could not perform the requested operation.
- Windows Resource Protection found corrupt files but was unable to fix some of them.
If WRP couldn’t repair the corrupt files, it indicates that the component store itself is suffering from some errors. In such cases, you need to run DISM first as this utility restores health of the component store.
Deployment Image Servicing and Management (DISM)
Deployment Image Servicing and Management (DISM) allows varieties of functions in Windows. One such use is to repair an online or offline Windows image.
The offline image means an image of a Windows system stored in .wim
or .esd
file. It can also be .vhd
, .vhdx
, or other virtual disk files that store the image. The online image refers to the active operating system and it basically includes the Windows Component Store.
You need to use one of three switches with the DISM /Cleanup-Image
functionality, /Checkhealth, /Scanhealth, and /Restorehealth.
/Checkhealth
: If any process that uses the component store fails, they flag the component as corrupted and store the record on the registry. It checks the registry for such records./Scanhealth
: It checks the component store for corruption and also records the logs./Restorehealth
: It first performs the same action as/Scanhealth
and then automatically attempts to fix any corruptions it finds.
By default, when you use DISM to repair a Windows image, it checks the component store for corruption using the data in the registry and the hash signature of the files.
If it detects any corruption, by default, it uses the Windows Update (WU) client to get the files necessary from the WU server to fix the corruption. But you can also use other sources by setting them manually or changing the default source in your Group Policy settings.
You must be connected to the internet to use Windows Update as the source. If not, it can only check for corruption but can’t fix them. It is always recommended to run DISM if SFC can’t resolve any system issue. Also, DISM only repairs the Windows image, so you should also run SFC again after running DISM to fix other system files.
How to Run DISM?
You also need to use command line interfaces like the Command Prompt to run DISM. If you don’t manually specify any source, it automatically uses the default one.
- Open Run by pressing Win + R.
- Type
cmd
and press Ctrl + Shift + Enter to open the Elevated Command Prompt. - Type the following commands one at a time and press Enter after each:
dism /online /cleanup-image /checkhealth
dism /online /cleanup-image /scanhealth
dism /online /cleanup-image /restorehealth
If you are not connected to the internet, you need to provide a manual source to be able to run the restore health command.
DISM /Online /Cleanup-Image /RestoreHealth /Source:wim:E:\sources\install.wim:1 /limitaccess
Here, /limitaccess
prevents DISM from using the Windows Update.
You need to replace the path and type of Windows image (wim
or esd
) as well as the index number (1 in the above example) with the appropriate parameters.
If you don’t know the index number, use the command
dism /get-wiminfo /wimfile:E:\sources\install.wim
and check the number for your Windows version.
If you need to use DISM to check and fix an offline Windows image, such as from the Windows Recovery Environment, you need to replace /online
with /image:“path to offline image”
while also providing a manual source.
The recovery environment also rearranges the drive letter, so you need to figure them out by using the diskpart
command to specify the path for the /Image
and the /Source
The command would look like this:
DISM /Image:C:\ /Cleanup-Image /RestoreHealth /Source:esd :E:\sources\install.esd:6 /limitaccess
If you are running DISM from the recovery environment, it’s best to run SFC as well. Similar to DISM, you need to add other parameters to run this program in an offline environment. Here’s the command:
SFC /Scannow /offbootdir=C:\ /offwindir=C:\windows
Here, the offbootdir represents the drive with the boot files and offwindir represents the drive with Windows OS. They may not be C:
or even the same letter in the recovery environment, so you need to replace them accordingly.
Run the bcdedit
command and look for device and osdevice under Windows Boot Loader for the respective values.
Disk Checking (CHKDSK)
The Disk Checking Utility (CHKDSK) checks the disk for any file system or sector-level corruption. You need to run this tool whenever you encounter any disk or file system-related errors, such as copy/paste functions not working, an external drive not opening, and so on.
CHKDSK works by checking the file system and partition metadata to look for logical and physical disk corruption. You can only check one partition or drive at a time. And if you don’t specify any drive, it checks your system drive (usually C:).
Depending on your need, you need to use separate flags with the CHKDSK command. If you don’t use any flags, it only checks the drive for errors but doesn’t attempt to fix them. Some important flags are:
/f
– CHKDSK fixes all possible logical errors on the disk. It does not take much time as you are only checking the partition information and the file system.
/r
– CHKDSK checks for bad sectors and attempts to recover their contents to good sectors while also fixing logical errors on the disk (i.e., it integrates /f flag). Depending on the corruption, this process can take from a few minutes to a few hours.
/x
– This flag forces the disk to dismount so that no read/write operations occur while scanning and fixing the drive. If you don’t use this flag, CHKDSK asks you if you want to unmount the volume if it is in use by some other process.
- It has many other flags as well, which you can check by running the command
chkdsk /?
How to Run CHKDSK?
You can run the Disk Checking utility using a graphical interface by going to a drive’s properties. However, it does not give you different options for customizing the scan and repair process. So, it’s better to run this utility using the Command Prompt.
- Open Run by pressing Win + R.
- Type
cmd
and press Ctrl + Shift + Enter to open the Elevated Command Prompt. - Enter the CHKDSK command. For instance,
chkdsk D: /r /x
- Confirm any prompts. If you want to scan your system drive (usually C:), you need to restart your PC.
When to Run DISM, SFC, and CHKDSK?
To summarize these utilities, SFC repairs all protected system files for any corruption and uses the Windows Store components as a repair source. And DISM checks your component store for corruption and repairs it using the Windows Update.
So you should try running the SFC whenever you encounter any system issues. If SFC doesn’t run properly or can’t resolve your issue, run DISM and then SFC again.
As for CHKDSK, you should run it if the issue you are experiencing is related to storage drives or disks. If you can’t determine the nature of the problem, it’s fine to run all three utilities as they won’t make the issue worse even if they don’t prove useful.