Troubleshooting Windows: How to Fix Hard Drive Issues Using Command Line

Abstract: Fix hard drive errors, file system corruption, and boot failures using chkdsk, sfc, and diskpart commands.

Created: 2026-10-21 by

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, type cmd 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

While chkdsk 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, the diskpart 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 include 0x80070057 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.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More