What Is Dirty Bit And How To Manage It in Windows

What Is Dirty Bit And Everything There Is To Know About ItWhat Is Dirty Bit And Everything There Is To Know About It

Key Points

  • Dirty bit is a binary value on the memory which indicates if any changes have been made to the page by the system hardware.
  • “1” signifies that the page loaded in the memory is modified, and “0” implies that it is the same as the one saved in the secondary storage.
  • To check Dirty bit’s status, run the command “Fsutil dirty query [DriveLetter]:” in an elevated Command Prompt.

The term “Dirty bit” is used in the computing world which signifies a literal binary bit value in the system memory. This bit value is also referred to as the “modified bit”, and can have a value of either 0 (zero) or 1 (one), and signifies whether or not a value has been changed in that storage segment by the system hardware.

For example, if a page running on memory has been modified and not yet saved in the storage, the Dirty bit will set its value to 1. This will then let the system, or any apps that check for the Dirty bit’s value, know that the final version of the page is not permanently stored on the computer. Once the page is saved, the Dirty bit’s value will return to 0.

That said, there are some errors and issues users may occasionally encounter that are tangled with the Dirty bit. This guide gives detailed information on Dirty bit, how to check its status, and how to set or clear it.

What is the Dirty bit?

As mentioned earlier, the Dirty bit is a single bit value within the system’s memory which tells the other apps, programs, and anything that queries the value whether or not the storage segment has been modified by the system hardware or not.

When the Dirty bit’s value is zero, it is “clear,” and when its value is one, it means that the Dirty bit is “set.” The binary value for Dirty bit is usually automatically adjusted by the system, but may occasionally require manual interference to perform certain tasks.

For example, you may find “Optimization not available” when attempting to defragment drives. This will likely be because the Dirty bit is set. As long as the Dirty bit is set, you will not be able to optimize the drive.

Additionally, as people have reported, any time they boot up the computer, it attempts to perform a disk check. They then quickly have to press a key to bypass the check, and this keeps happening and won’t go away. This issue likely occurs when the Dirty Bit is set and will not clear/reset itself. In this case, you must manually set it to zero.

How to check if a partition is Dirty

Each storage segment has its individual Dirty bit. On a Windows computer, you can check the status of the Dirty bit for individual volumes and partitions.

To check and confirm whether a volume is dirty or not, you can use the fsutil command in the Command Prompt. More precisely, the “fsutil dirty” command is used to query the Dirty bit and retrieve its value. Use the following steps to check whether a partition volume is dirty or not using its drive letter:

  1. Press the Windows Key + R to open the Run Command box.

  2. Type in “cmd” and press CTRL + Shift + Enter to run an elevated Command Prompt.

  3. Now run the following command to check the status of a volume while entering your own drive letter in place of “[DriveLetter]”:

    Fsutil dirty query [DriveLetter]:
    Check Dirty bits status from Command Prompt
    Check Dirty bit’s status from the Command Prompt

As you can see in the image above, the Dirty bit for all 3 of the partitions came back as “not dirty.” This means that its value is 0, and there is no difference between the files loaded in the memory and those saved on the storage disk.

How to set Dirty bit

You can not only query the status of a Dirty bit for a storage segment, but you can also change its value from 0 to 1, meaning that you can “set” it. Setting the Dirty bit is relatively easier than clearing/resetting it.

Use these steps to set the value for a Dirty bit for a particular partition volume:

  1. Press the Windows Key + R to open the Run Command box.

  2. Type in “cmd” and press CTRL + Shift + Enter to run an elevated Command Prompt.

  3. Now run the following command while replacing [DriverLetter] with the drive letter of the partition that you want to set the dirty bit of:

    fsutil dirty set [DriveLetter]:
    Set the Dirty bit to 1
    Set the Dirty bit to 1

    When you run this command, you will be prompted to restart the computer. Do not restart just yet.

  4. Run the following command to confirm that the Dirty bit’s value has changed;

    Fsutil dirty query [DriveLetter]:
    Check Dirty bits status after setting it
    Check Dirty bit’s status after setting it

As you can see from the image above, the Dirty bit’s value has been changed and set to 1, since the Command Prompt returned “D: is Dirty“.

How to remove/ clear Dirty bit

We have already discussed how to check Dirty bit’s status and how to set it, now let us see how to clear it, meaning change its value from 1 to 0. This technique comes in handy when you are experiencing issues with the Windows OS when performing certain tasks, such as defragmenting partitions, or avoiding the CHKDSK at every bootup.

In case it is the latter, going through with the disk checkup is one way of clearing the Dirty bit. Of course, this will require some time as the CHKDSK utility takes its time to perform a deep scan of the storage. Alternatively, you can adopt any of the following solutions to clear the Dirty bit. We recommend that you adopt the solution that best fits your situation and circumstances.

For example, one of the solutions is formatting the hard drive after backing up your data. It may be possible that a data backup may not be suited for you because the device is completely online, or the data to backup is huge, in which case you should shift to the second or the third solution below.

Reset Dirty bit by formatting hard drive

Formatting the hard drive usually resets the Dirty bit even if performing the CHKDSK scan does not work. Before you format your hard drive, make sure to back up your data completely. You can use the Windows native File History or the Backup and Restore (Windows 7) features to perform a backup or use our top selection of disk imaging and backup software.

Once you have successfully backed up your data, use the following steps to format the drive:

Alternatively, you can also format the drive using Command Prompt.

  1. Press the Windows Key + R to open the Run Command box.

  2. Type in “diskmgmt.msc” and press Enter to open the Disk Management Console.

  3. In the lower section of the console, right-click on the hard drive you want to format and click Format.

    Format drive
    Format drive
  4. Confirm that “Perform a quick format” is selected and then click OK.

    Quickly format the disk using Disk Management Console
    Quickly format the disk using Disk Management Console
  5. When asked for confirmation, click OK again.

    Confirm action
    Confirm action

    The disk will now be formatted.

  6. When the formatting process completes, click OK to dismiss the dialog box.

  7. You may now continue to restore your backed-up data.

After performing these steps the Dirty bit should be cleared and the repeated CHKDSK scan should be gone when booting into Windows.

Reset Dirty bit using hex editor

Hex editors are software that allows you to modify and manipulate the fundamental binary data stored across various places. While you can safely download many hex editors online, only a handful of them can write back hex values. Which is why we chose to use WinHex.

Using WinHex, apply the following steps to reset and clear the Dirty bit value for a particular drive:

  1. Open the WinHex page and click Download.

    Download WinHex
    Download WinHex
  2. Once downloaded, extract the contents and run the WinHex app with administrative rights.

    Run WinHex as admin
    Run WinHex as admin
  3. In the app, click Tools from the ribbon menu and then click “Open Disk.”

    Open disk with WinHex
    Open disk with WinHex
  4. Select the disk and click OK.

    Select the disk
    Select the disk
  5. Search for the Hex value “03 01 80”, and it should be ending with “80 00 00 18.”

    Note: On NTFS disks, there is no fixed Offset for the Dirty bit value. Therefore, if the Dirty bit value is set (which you must check beforehand using the given guide above), its hex should be as mentioned above.

    Search for Hex value
    Search for Hex value
  6. Replace “80” in the Hex value with “00” and save the changes.

Performing these steps using a hex editor to clear the Dirty bit can be quite confusing for some. Therefore, if you are seeing the CHKDSK message every time you boot into Windows, then you can also apply the following simple solution to fix the issue.

Block disk checking using CHKNTFS

One of the effects that the Dirty bit has when it is set is the repeated disk checking intimation every time you try and boot into Windows. While the methods to reset the Dirty bit can be complicated, another workaround for getting rid of the CHKDSK prompt is disabling the CHKDSK prompt itself. this can be achieved with the CHKNTFS command.

CHKNTFS is used to display or hide the automatic disk checking when the computer boots up. Use the following steps to disable disk checking:

  1. Press the Windows Keys + R to open the Run Command box.

  2. Type in “cmd” and press CTRL + Shift + Enter to launch an elevated Command Prompt.

  3. Run the following command while replacing [DriveLetter] with the drive letter for your primary disk/drive.

    chkntfs /x [DriveLetter]:
    Disable automatic disk check at startup
    Disable automatic disk check at startup

Now, if you were getting the CHKDSK prompt at startup because of the Dirty bit, it should no longer bother you, regardless of its value.

Our take on Dirty bit

Personally, I have never had any issues on Windows due to the Dirty bit. However, after researching, we found that different users have experienced issues because of it in different aspects. For example, while one user suffers with the automatic disk checking every time the start computer, another user sees the following error when trying to defragment their drive:

Optimization not available

That being said, after having performed the steps above, I found that checking the Dirty bit’s status and setting it (0 to 1) was a lot easier than trying to reset it. Clearing or resetting the Dirty bit using a Hex editor is truly not a walk in the park It requires time, focus, and most importantly, the determination to find the defined hex values so that they can be appropriately replaced.

Therefore, if I were ever in a similar situation because of the Dirty bit, I would prefer using the alternate methods.

Ending thoughts

Normally, the users have no direct interaction with the Dirty bit. However, when it comes to troubleshooting, they can often find themselves in tricking situations that could only be resolved by manipulating its value.

This guide provides a step-by-step guide on how to check the Dirty bit’s status, set it, and reset it if needed.

If you liked this post, Share it on:
Subhan Zafar is an established IT professional with interests in Windows and Server infrastructure testing and research, and is currently working with Itechtics as a research consultant. He has studied Electrical Engineering and is also certified by Huawei (HCNA & HCNP Routing and Switching).

Get Updates in Your Inbox

Sign up for the regular updates and be the first to know about the latest tech information