During a chkdsk scan, the system was characterized as “dirty”. What
does that imply?
For the record, it has nothing at all to do with porn.
But it does have everything to do with how Windows manages your hard
disk, how it optimizes reading and particularly writing to the disk,
and how you turn off your computer.
Yes, the most common reason for a dirty hard drive is turning off
your system the wrong way.
To oversimplify, the concept is very simple, Windows sets a “dirty” flag on your hard drive whenever it has unfinished business with the drive.
One example of “unfinished business” is that Windows can optimize disk access by buffering data to be written so that it can be written in a single, larger operation, rather than a number of smaller ones. While the data has been collected, but before it’s completely written to disk, the disk is considered “dirty” – not all the data that should be written to the disk has been. Once all the data has been actually, physically placed on the hard disk, the disk might be considered “clean”.
This kind of halfway state, with data only partially written on the hard disk, is actually common, and programs running on the system – and even large parts of Windows itself – are completely unaware that this is happening. They hand off data to the disk management system to be written, and simply assume that it will be, in some kind of timely fashion. (Optimizing disk access while maintaining data integrity and system speed is actually a very complex topic and the subject of a lot of system design effort. How data eventually makes it to the disk and in what order can be thought of as so much black magic these days.)
So why is all of this important? Well, consider this: you perform a “Save As…” in your favorite word processing program to save a copy of your document under a new name. Until both all of the file’s data, and its entry in the filesystem’s list of files or “directory” are physically on the disk, the filesystem could be considered dirty. What happens if the power goes out halfway through writing the file?
Your machine has been shut down with a dirty file system.
Typically, that means on reboot CHKDSK will be run automatically to check for and repair any errors on the disk.
And it also means you might lose the file you were writing at the time the power went out.
Now, losing power in the middle of editing a document is something most people understand, but the situation is actually a lot more common than you might think for two reasons:
For all intents and purposes, Windows is constantly writing files to the hard disk.
Many people “shut down” their computer by just turning off the power. This is bad.
By just turning off the power to your computer there’s a very high chance that you would be interrupting Windows as it writes its files to your hard disk. Most of the time it turns out to be benign, but sometimes it can be disastrous. Sometimes you’ll get unlucky enough to interrupt Windows writing something extremely important and you could suffer significant loss of data.
The correct way to turn off your system is to click on the Start button (to Start the process of shutting down), and click “Turn off Computer” or the equivalent. Windows will take a little time to clean things up, shut down all the programs on your machine, and ensure that the disks are marked “clean” before finally turning your machine off.
One source of confusion is that the power button on many computers will actually act as a software shortcut to this process of shutting down. If pressing and releasing the power button starts what appears to be a sequence of applications closing, and eventually the message “Windows is shutting down”, then you’re ok. If everything suddenly just turns off, or if you have to hold down your power button for several seconds and everything turns off, then you’re risking a serious problem.