Logo
programming4us
programming4us
programming4us
programming4us
Windows XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
 
Windows Vista

Crashes and Error Messages (part 4) - Check Your Drive for Errors with Chkdsk

12/7/2011 9:18:25 AM

4. Check Your Drive for Errors with Chkdsk

The Chkdsk utility—chkdsk.exe, pronounced "check disk" for those who enjoy pronouncing program executable filenames—scans your hard disk for errors and optionally fixes any it finds. To run Chkdsk, open a Command Prompt window (cmd.exe), type chkdsk at the prompt, and press Enter.

File errors—one of the problems Chkdsk can detect and fix—are also capable of preventing Windows from booting. If Windows won't start, use the Safe Mode with Command Prompt startup option .


When you run Chkdsk without any options, you'll get a report that looks something like this:

The type of the file system is NTFS.
Volume label is SHOEBOX.

WARNING! F parameter not specified.
Running CHKDSK in read-only mode.

CHKDSK is verifying files (stage 1 of 3)...
156352 file records processed.
File verification completed.
433 large file records processed.
0 bad file records processed.
2 EA records processed.
54 reparse records processed.
CHKDSK is verifying indexes (stage 2 of 3)...
586626 index entries processed.
Index verification completed.
5 unindexed files processed.
CHKDSK is verifying security descriptors (stage 3 of 3)...
156352 security descriptors processed.
Security descriptor verification completed.
18159 data files processed.
CHKDSK is verifying Usn Journal...
36020056 USN bytes processed.
Usn Journal verification completed.
Windows has checked the file system and found no problems.

105520148 KB total disk space.
58674344 KB in 134061 files.
60396 KB in 18160 indexes.
0 KB in bad sectors.
320208 KB in use by the system.
65536 KB occupied by the log file.
46465200 KB available on disk.

4096 bytes in each allocation unit.
26380037 total allocation units on disk.
11616300 allocation units available on disk.


You can interrupt Chkdsk at any time by pressing Ctrl-C.

If Chkdsk finds any errors, it'll say so in its report. However, as suggested by the WARNING! F parameter message in the report, it won't fix any problems it finds unless you specifically instruct it to do so with the /f parameter, like this:

chkdsk /f

The following terms describe most of the different types of problems that Chkdsk might report:


Lost clusters

These are pieces of data that are no longer associated with any existing files. They just need to be cleaned up.


Bad sectors

Bad sectors are actually physical flaws on the disk surface. Use the /r option, explained shortly, to attempt to recover data stored on bad sectors. Note that recovery of such data is not guaranteed (unless you have a backup somewhere).

You may have one or more bad sectors if you see gibberish when you view the contents of a directory (with the dir command), or if Windows crashes or freezes every time you attempt to access a certain file.



Cross-linked files

If a single piece of data has been claimed by two or more files, those files are said to be cross-linked.


Invalid file dates or times

Chkdsk also scans for file dates and times that it considers "invalid," such as missing dates or those before January 1, 1980.

By default, Chkdsk will only scan the current drive (shown in the prompt—C:> for drive C:). To scan a different drive, include the drive letter as one of the command-line options, like this: chkdsk d: /f.


The other important options available to Chkdsk are the following:


/r

The /r parameter is essentially the same as /f, except that it also scans for—and recovers data from—bad sectors, as described earlier. This just takes longer, and probably isn't necessary unless /f is insufficient.


/b

When Chkdsk finds a bad sector (as the result of an /r scan), it effectively "fences off" the region so Windows can never store data there again. Use the /b parameter to recheck those regions in the hopes that they can be used once again. For obvious reasons, this is usually not a good idea, and is pretty much a big waste of time.


/x

Include this option to force Windows to dismount the volume before scanning the drive, a useful step for drives with shared folders . If you don't include /x, and the drive is in use, Chkdsk usually has to schedule a scan during the next boot. The /x parameter implies the /f option.

There are also the /i and /c options, which are used only to skip certain checks in order to complete the scan more quickly; there's usually no reason to use them.

To run Chkdsk from Windows Explorer, right-click any drive, select Properties, choose the Tools tab, and click Check Now. Here, the Automatically fix file system errors option corresponds to the /f parameter, and the Scan for and attempt recovery of bad sectors option corresponds to the /r parameter. Unfortunately, this way, you don't get the detailed report. And when Windows won't start, the Command Prompt interface is basically your only choice.

4.1. Dirty drives and automatic scans

When a volume is marked "dirty," Windows scans it with Chkdsk automatically during the boot process. A drive can become dirty if it's in use when Windows crashes, or Chkdsk schedules a scan when you attempt to check a disk that is in use. A drive not considered dirty is marked "clean" (no surprise there).

You can use the Fsutil (Fsutil.exe) utility to manage dirty drives. Open a Command Prompt window and type fsutil (without any arguments) to display a list of commands that can be used with the tool. As you might have expected, the dirty command is the one that's most relevant here. Here's how it works:

To see whether drive G: is currently marked as dirty, type:

fsutil dirty query g:

To mark drive H: as dirty, so it will be scanned by Chkdsk the next time Windows starts, type:

fsutil dirty set h:

Fsutil has been found to be unreliable when used on FAT or FAT32 drives, so you may wish to use it only on more modern NTFS disks.


Another utility, Chkntfs, is used to choose whether or not Windows runs Chkdsk automatically at Windows startup, regardless of the so-called cleanliness of the drive. (It is not used to check NTFS drives, as its name implies, however.) Here's how it works:

To display a dirty/clean report about any drive (say, drive G:), type:

chkntfs g:

To exclude drive H: from being checked when Windows starts (which is not the default), type:

chkntfs /x h:

To include (un-exclude) drive H: in the drives to be checked when Windows starts, type:

chkntfs /c h:

To force Windows to check drive H: the next time Windows starts, type:

chkntfs /c h:
fsutil dirty set h:

To include all drives on your system, thereby restoring Vista's defaults, type:

chkntfs /d

Finally, when Windows detects a dirty drive, it starts a timed countdown (10 seconds by default), allowing you to skip Chkdsk by pressing a key. To change the duration of this countdown to, say, five seconds, type:

chkntfs /t:5

The Registry location of the timeout setting is stored in the AutoChkTimeOut value in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager key.


You'll have to restart Windows for any of these changes to take effect.

Other -----------------
- Migrating User Data : Understanding User Data
- Working with Windows Installer : The MSI Package Lifecycle
- Managing Windows Vista : Backing Up Your Files & Restoring Backed-Up Files
- Understanding the Capabilities of Windows Installer (part 2) - Managing the Windows Installer service
- Understanding the Capabilities of Windows Installer (part 1) - Understanding the Windows Installer architecture
- Working with Windows Installer : Introducing Windows Installer
- Managing Windows Vista : Managing Settings for a Presentation
- Managing Windows Vista : Controlling the Power Options
- Add an Xbox 360 : Configure the Windows Vista–Based PC
- File Type Associations (part 4)
 
 
Trailer game
Video tutorials
- How To Install Windows 8 On VMware Workstation 9

- How To Install Windows 8

- How To Install Windows Server 2012

- How To Disable Windows 8 Metro UI

- How To Change Account Picture In Windows 8

- How To Unlock Administrator Account in Windows 8

- How To Restart, Log Off And Shutdown Windows 8

- How To Login To Skype Using A Microsoft Account

- How To Enable Aero Glass Effect In Windows 8

- How To Disable Windows Update in Windows 8

- How To Disable Windows 8 Metro UI

- How To Add Widgets To Windows 8 Lock Screen
programming4us programming4us
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 windows Phone 7 windows Phone 8
programming4us programming4us
 
Popular keywords
HOW TO Swimlane in Visio Visio sort key Pen and Touch Creating groups in Windows Server Raid in Windows Server Exchange 2010 maintenance Exchange server mail enabled groups Debugging Tools Collaborating
programming4us programming4us
Trailer game
 
programming4us
Girls
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone