Using CHKDSK from the Command Line

XP includes the Check Disk utility as a way to search for and repair file system errors on your hard disks. While the graphical version of the tool is accessible from the Tools tab in the properties of a disk, XP also includes a command-line version of the tool in the form of CHKDSK. When run from the command line, this tool allows you to scan for file system errors, fix those errors, and even specify which specific files should be checked if you don’t want to scan an entire volume.

For example, the command CHKDSK E: /R will scan drive E: for errors, and fix any errors encountered. An example of this command is shown below. As part of your regular maintenance schedule, run CHKDSK at least once per month to ensure good disk and file system health.

Why Is Disk Defragmentation Necessary?

When files are saved to a hard disk, they aren’t necessarily saved in an area of contiguous disk space. For example, a 10 K file might be fragmented and spread over three disparate disk clusters, each 4 K in size. When this file is accessed, the system needs to obtain the contents of each of the clusters to open it, which would involve reading different areas of the disk for a single file. When defragmentation is performed, fragments of the same file are saved in contiguous areas of disk space, thus speeding up read access to the file and improving performance.

Keep Your Hard Tidy with the Disk Cleanup Tool

Over time, your PC will become cluttered with unused programs, temporary files, and deleted items stored in the Recycle Bin. Regardless of their location on your system, all of these files are capable of using up large tracts of your system’s disk space, something which can be detrimental from both a performance and available storage point of view. Quite simply, the more unnecessary files stored on your system, the less valuable disk space you have at your disposal. Disk Cleanup is the native Windows tool provided for the purpose of quickly finding and ridding your PC of unnecessary files, and you’ll want to run it at least monthly as part of your scheduled system maintenance activities.

Disk Cleanup is accessible via the Accessories > System Tools group on the Start menu. When this utility is opened, it will ask you to choose a drive to scan, and then calculate the amount of disk space that is being used by everything from Temporary Internet Files to the contents of your Recycle Bin. By simply checking the checkbox next to the appropriate item, Windows will permanently delete the selected files, allowing you to reclaim the associated disk space. Again, run Disk Cleanup at least once per month on your system, and more often if your usage is extremely high.

Testing For Drive Errors and Health with Check Disk

While defragmenting a partition will speed up disk access by placing files in contiguous disk clusters, another key disk maintenance task that should be performed at least monthly is running Check Disk. On a Windows 2000 or XP system, Check Disk is accessible from the Tools tab in the properties of a drive (like C). To open the tool, press the Check Now button in the Error-checking section.

Check Disk has two main purposes – to check for file system errors, and to scan for bad disk sectors and fix them if possible. As an electromagnetic component, a hard disk is susceptible to surface errors, so it’s important for the system to be aware of them and allocate data to known good sectors. By the same token, file system errors can cause data loss or system instability, so you’ll definitely want to check for them as well. Both tasks are easily configured by selecting the appropriate check boxes in the Check Disk tool.

As a general rule, Check Disk should be run at least once per month on newer systems, and more often (perhaps once every two weeks) on older PCs. If your PC is running an older version of Windows like 98 or ME, Check Disk is not included. Luckily, these systems include an older utility known as Scandisk – while it’s not quite as pretty as Check Disk, Scandisk performs similar disk checking functions on these versions of Windows.

Defragment Your Hard Drive for Better System Performance

While handling everything from the installation of programs to the storage of various data files, your PC’s hard disk drive is a workhorse that takes a great deal of punishment over time. As programs are installed and various data files are added and deleted, a hard disk eventually becomes fragmented, leaving bits and pieces of files spread across different (and non-contiguous) disk clusters. In simple terms, a fragmented hard disk will not perform optimally, since all of the fragments of a file must be assembled when that file is opened. Over time, fragmentation can severely degrade the performance of your hard disk, since individual fragments need to be searched for and reassembled by the system. If your PC seems slow right now, performing disk defragmentation often has a huge impact towards improving system performance.

Operating systems from Windows 95 forward have included a utility called Disk Defragmenter. As its name suggests, the primary role of this tool is to defragment your system’s hard disk on a partition-by-partition basis. The process begins by analyzing a partition to find its current degree of fragmentation, and then suggests whether defragmentation is necessary based on its findings. As a general rule, you should run Disk Defragmenter at least once per month on busy partitions like your C drive. When fully defragmented, your hard disk will be much more responsive, with files and programs opening much more quickly that they otherwise would. For details on how to use the Disk Defragmenter on an XP PC, see the details below. Note that the process can take quite some time on a system with badly fragmented partitions, so you might want to consider running it overnight the first time.

Step 1: Click Start, and select All Programs. Select Accessories > System Tools, and then click Disk Defragmenter. The Disk Defragmenter window will open. All partitions configured on your system will be listed, along with information about available disk space.

Step 2: Click the Analyze button. This will analyze the partition currently selected for fragmentation, and will graphically display the current state of fragmented, contiguous, and unmovable files on your system.

Step 3: Once the analysis is complete, you will be presented with the Disk Defragmenter dialog box. Click the View Report button to view the reported findings of the analysis. Scroll down to view information such as total fragmentation for the partition.

Step 4: If the Disk Defragmenter suggests that the partition need to be defragmented, click the Close button on the Analysis Report dialog box and then click the Defragment button. The defragmentation process can take anywhere from minutes to hours based on your system and its current state, so a little patience will be necessary.

Recovering Data from Hard Drives

It happens to everyone. You’ve accidentally deleted a file, emptied the Recycle bin, and now you don’t have a backup and want the file back. The good news is that a recovery is possible. The bad news is that you shouldn’t get your hopes up. Once data is deleted it can usually be recovered by using any number of undelete utilities, but only if other data has not already overwritten those clusters.

This is another excellent reason to consider saving data to a different partition – the partition with the OS installed is usually written lots of data to disk behind the scenes such as temporary files, which may end up making your data unrecoverable. You best bet is to install an undelete application (like Undelete), before you need to worry about data recovery – installing the undelete utility might actually be what makes the file you just lost unrecoverable if it uses the same disk space.