Use built-in Windows command-line tools like chkdsk, sfc, and diskpart to diagnose and repair hard drive errors. Running these commands from an elevated Command Prompt allows you to fix file system corruption, recover lost data, and verify disk integrity without third-party software.
Accessing the Elevated Command Prompt
Before running any diagnostic or repair commands, you must have administrative privileges. Standard user accounts do not have permission to modify low-level disk structures or system files. To open the correct environment, click the Start button, typecmd in the search box, right-click on Command Prompt, and select Run as administrator. If prompted by User Account Control (UAC), click Yes to allow the app to make changes to your device. This step is critical because most disk repair utilities will fail with "Access Denied" errors if executed without elevated rights. Alternatively, you can press Windows Key + X and select Command Prompt (Admin) or Windows PowerShell (Admin) depending on your version of Windows.
Checking Disk Health with CHKDSK
The Check Disk utility (chkdsk) is the primary tool for identifying and fixing file system errors and bad sectors. It scans the physical surface of the drive for logical inconsistencies. The basic syntax requires you to specify the drive letter followed by parameters that define the depth of the scan. For a quick check that only fixes file system errors without scanning for bad sectors, use the command chkdsk C: /f. The /f flag instructs the tool to fix errors it finds. If the drive is currently in use by Windows, the system may ask you to schedule the check for the next restart.
For a more thorough analysis that includes scanning for bad sectors and attempting to recover readable information from them, add the /r parameter. The command becomes chkdsk C: /f /r. Note that this process can take several hours depending on the size and health of the drive. You should also consider adding the /x flag to force the volume to dismount first, ensuring no other processes are writing to the disk during the repair. For detailed logging of all actions taken, append /v to display every file and folder name checked. Always replace C: with the actual drive letter you wish to repair.
Repairing System Files with SFC
Whilechkdsk focuses on the physical disk structure and file system, the System File Checker (sfc) targets corrupted Windows system files that may cause boot failures or instability. These files are stored in protected directories and cannot be modified by standard applications. Run the command sfc /scannow to initiate a full scan and automatic repair of protected system files. This process compares current versions of critical files against their cached copies in the WinSxS folder.
If sfc reports that it found corrupt files but was unable to fix some of them, you may need to use the Deployment Image Servicing and Management tool (DISM). DISM repairs the Windows image that SFC relies on. Run DISM /Online /Cleanup-Image /RestoreHealth to download fresh copies of system files from Windows Update. After DISM completes successfully, run sfc /scannow again to ensure all system files are now intact. This two-step approach resolves issues where local cache corruption prevents SFC from repairing the operating system directly.
Managing Partitions with DiskPart
For more advanced issues involving partition tables or drive letters, thediskpart utility provides a powerful interface. Launch it by typing diskpart in the Command Prompt. Inside the tool, use list disk to view all connected storage devices. Identify your target drive by its size and model number. Select the disk using select disk N, replacing N with the disk number. Be extremely careful here, as selecting the wrong disk can lead to data loss.
Once the correct disk is selected, you can inspect its partitions with list partition. If a partition is missing a drive letter, you can assign one using select partition N followed by assign letter=X. For unallocated space, you can create a new primary partition with create partition primary and format it with format fs=ntfs quick. Always back up important data before modifying partition structures, as these operations can render existing data inaccessible if performed incorrectly.
Interpreting Error Messages and Next Steps
After running these commands, carefully review the output for specific error codes. Common codes include0x80070057 for invalid parameters or 0x800F0922 for DISM source file issues. If chkdsk reports a high number of bad sectors, the physical drive may be failing and should be replaced immediately. In such cases, focus on data recovery rather than further repairs. If system file repairs fail repeatedly, consider performing a clean installation of Windows. For related network or general troubleshooting issues, refer to our guide on Troubleshooting Windows Issues. Additionally, for broader methods of addressing hardware faults, see How to Fix Hard Drive Issues on Windows 7 and 10.
Frequently Asked Questions
Can CHKDSK recover deleted files?
No, CHKDSK does not recover deleted files; it only fixes file system errors and marks bad sectors as unusable. To recover deleted data, you must use specialized data recovery software or previous backups. Running CHKDSK on a drive with severe physical damage might actually overwrite recoverable data, so proceed with caution.
What should I do if sfc /scannow fails to fix errors?
If SFC fails, run the DISM command to repair the underlying Windows component store first. After DISM completes successfully, run SFC again to complete the file repairs. If both tools fail, the issue may require a system restore point or a clean OS installation.
Is it safe to run chkdsk while the computer is in use?
You can start CHKDSK while the system is running, but it will likely schedule the task for the next reboot if the drive is in use. Running it live on the active system drive can cause significant performance degradation and potential data corruption. It is best to let it run during startup or when the drive is not actively being written to.
How do I know if my hard drive is physically failing?
Look for repeated bad sector reports from CHKDSK, unusual clicking noises, or frequent blue screen errors. Use SMART monitoring tools like CrystalDiskInfo to check drive health status indicators. If SMART reports failure or reallocated sector counts are high, backup your data immediately and replace the drive.
Can I use these commands on external USB drives?
Yes, you can use CHKDSK and DISM on external drives, provided they are formatted with NTFS or exFAT. However, SFC only works on the system drive where Windows is installed. When using diskpart on external drives, ensure you select the correct disk to avoid wiping your internal SSD or HDD.