For ###DEIDCATED_SERVER###s running the Microsoft Windows Server 2019 and Microsoft Windows Server 2022 operating systems

This article explains how to use Checkdisk in the Windows Rescue system to repair a damaged file system.

You can use the chkdsk program to check file system data and file system metadata on disks for logical and physical errors. If you use chkdsk without parameters, this program checks the selected disk and displays any errors it detects. If you run chkdsk with parameters, the program additionally repairs the logical file system errors it finds. If bad sectors are found on a disk due to physical damage, chkdsk can attempt to recover the data from the affected disk sectors.

Notes

Start chkdsk

If the file system structure becomes corrupted, Windows plans to run chkdsk automatically the next time the computer is restarted. After the reboot, chkdsk checks the drive and corrects errors automatically. If the drive partition is a boot partition, chkdsk automatically restarts the computer after the drive is checked.

In addition, there are the following ways to start chkdsk:

Running chkdsk in the Command Prompt

If your server is still booting with the existing operating system, you can invoke chkdsk using the command prompt. To do this, follow these steps:

Requirements
  • You have logged in to the server as an administrator.

  • You have ensured that no files are open on the data carrier.

  • You have terminated all programs and processes that access the data carrier to be checked.

  • In the search bar located in the taskbar, type cmd.

  • Double-click Command Prompt.

  • To check the selected disk, type the chkdsk command and the drive letter of the drive you want to check at the command prompt.

    To use special scan options or repair options, type the chkdsk command with the following syntax:

    chkdsk Disk:\Path\Filename [/f] [/v] [/r] [/x] [/i] [/c] [/l] [:Size]] [/b] [/scan]

    Example:

    chkdsk /f c:

Opening chkdsk in the Rescue System

If your server's operating system no longer boots, you must boot the server into the rescue system. You can then run the chkdsk program in the rescue system. To do this, proceed as follows:

  • Log into the Cloud Panel.

  • In the Infrastructure > Server area, select the desired server.

  • Click on Actions > Restart.

  • Select the Rescue System method and the desired rescue system. The bit rate of the rescue system (32- or 64-bit) must match the bit rate of the operating system installed on the server.

  • Click Yes.

    The server boots into the Rescue system.

  • Scroll down to the Functions section.

  • To log into the Rescue system on your server, click the Start VNC Console link.

    The VNC Console window opens.

  • Select the desired keyboard layout.

  • To access the problem diagnosis tools, click Troubleshoot > Microsoft ® Diagnostics and Recovery Toolset.

  • Click on the Administrator: X:\WINDOWS\system32\cmd.exe window.

  • To scan the selected disk, type the chkdsk command and the drive letter of the disk you want to scan at the command prompt.

    To use special scan options or repair options, type the chkdsk command with the following syntax:

    chkdsk Disk:\Path\Filename [/f] [/v] [/r] [/x] [/i] [/c] [/l] [:Size]] [/b] [/scan]

    Example:

    X:\Windows\system32\chkdsk /f c:

Important parameters

The most important parameters for chkdsk are listed below:

Parameter Description
/f With this parameter chkdsk fixes errors on the disk. The disk must be locked. If chkdsk cannot lock the disk, a message is displayed asking if you want to check the disk the next time you restart the computer. Therefore, make sure that no files have been opened on the disk.
/r Use this parameter to make chkdsk search for bad sectors and recover readable information. Use this parameter to find physical disk errors in the file system and try to recover data from affected disk sectors. The /r parameter contains the functionality of /f. The disk must be locked. If chkdsk cannot lock the disk, a message is displayed asking if you want to check the disk the next time you reboot the computer.
/x Forces the disk to unmount first, if necessary. All open references to the disk are then invalid (means /f).The /x parameter contains the functionality of /f.
/? The /? parameter displays the help for chkdsk.

You can find more information in the following Microsoft article:

chkdsk

Removing a Dirty Bit with chkdsk

If the file system is damaged (dirty file system), the so-called dirty bit is automatically set. The dirty bit indicates that the file system may be in an inconsistent state. This is set automatically in the following cases:

  • Changes are pending and the server is restarted before these changes are applied.

  • Changes are pending and the server was shut down before the changes were committed to the disk.

  • Damage has been detected on the disk.

If a dirty bit is set, the chkdsk program is run after each server restart. It may happen that no error is found and chkdsk is run again after each restart. To check and repair the file system in this case, you must stop chkdsk from starting automatically. After you boot the server into rescue mode, you can repair the file system. To do this, proceed as follows:

Prerequisite
  • You have already created a backup of your servers.

  • Boot your server into the Windows rescue system. For instructions, see the section Opening chkdsk in the Rescue System.

  • To check whether a dirty bit is set in the file system, enter the following command in the Administrator: X:\WINDOWS\system32\cmd.exe window:

    C:\>chkntfs C:

  • To stop checkdisk from starting automatically on the next reboot, type the following command:

    C:\>chkntfs C: /x

  • Boot the server into the Windows rescue system.

  • Select desired keyboard language.

  • Click Troubleshoot.

  • Click on Microsoft ® Diagnostics and Recovery.

  • Click Windows Server 2019 or Windows Server 2022.

  • To check and repair the file system, in the Administrator: X\WINDOWS\system32\cmd.exe window, type the following command.

    C:\>chkdsk C: /F

  • After repairing the file system, check if the dirty bit was removed. If the dirty bit was removed, you will see the following message:

    C:\>chkntfs C:
    The type of the file system is NTFS.
    C: is not dirty.

    C:\>