Your personal computer is a combination of digital data and hardware machinery. To keep your system running smoothly, one needs to perform some regular maintenance jobs. We recommend to do the following tasks regularly for a crash free smooth running of the system.
Checking Disks for ErrorsErrors in hard disk and in the file system can cause a variety of Windows problems, ranging from an inability to open or save files to blue-screen errors and widespread data corruption. Though Microsoft Windows XP is capable of recovering automatically from many disk errors, it works specially on drives formatted with NTFS.
To perform a thorough inspection for errors, you can manually run the Windows XP Check Disk utility, Chkdsk.exe. Two versions of this utility are available—a graphical version that performs basic disk-checking functions, and a command-line version that provides a much more extensive set of customization options.
To check for errors on a local disk, follow these steps:
1. Open My Computer, right-click the icon belonging to the drive you want to check, and then choose Properties from the shortcut menu.
2. On the Tools tab, click the Check Now button.
3. In the Check Disk dialog box, select from the following options.
■ Automatically Fix File System Errors Select this option if you want Windows to automatically repair any file system errors. If this option is not selected, Check Disk reports any errors it finds but does not change them. This option is the equivalent of running the Chkdsk command with the /F switch, as described later in this section.
■ Scan For And Attempt Recovery Of Bad Sectors Select this option to perform an exhaustive check of the entire disk, locate bad sectors, and recover readable information stored in defective locations. Note that selecting this option automatically repairs file system errors as well, even if the previous option is cleared. This option is the equivalent of running the Chkdsk command with the /R switch. If you simply want to see a report of file system errors without making any changes to disk structures, leave both boxes unchecked.
4 Click Start to begin the disk-checking process. The green progress bar provides feedback as the error-checking tool goes through several phases. If you select the Automatically Fix File System Errors option on a drive that currently has open files, Windows is unable to run the utility immediately. In that case, you see the message.
Click Yes to schedule the disk check to run the next time you start your computer. The disk check occurs during the character-mode startup phase of Windows; during this period your computer is not available for you to perform any other tasks. When your computer starts, Windows notifies you that it’s about to perform a scheduled disk check; by default, you have 10 seconds to cancel the operation and boot normally instead.
After Check Disk completes its operation, it reports its results. If the disk check turns up no errors, you see a Disk Check Complete dialog box. If Check Disk uncovers any errors, it writes a message to the Event log and displays a dialog box listing the errors it found and the repairs it made.
The command-line version of Check Disk gives you considerably more options. It also allows you to schedule disk-checking operations using the Scheduled Tasks folder. To run this command in its simplest form, log on using an account in the Administrators group, open a Command Prompt window (by typing cmd in the Run box, for instance), and then type chkdsk at the prompt. This command runs Chkdsk in read-only mode, displaying the status of the current drive but not making any changes. If you add a drive letter after the command (chkdsk d:, for instance), the report applies to that drive.
You can use any combination of the following switches at the end of the command line to modify its operation:
● /F Instructs Chkdsk to fix any errors it detects. This is the most commonly used switch. The disk must be locked. If Chkdsk cannot lock the drive (as is always the case with the system drive), it offers either to check the drive the next time you restart the computer or to dismount the volume you want to check before proceeding. Dismounting is a drastic step; it invalidates all current file handles on the affected volume and can result in loss of data. You should decline the offer. When you do, Chkdsk will make you a second offer—to check the disk the next time you restart your system. You should accept this option.
● /V On FAT32 volumes, /V displays verbose output, listing the name of every file in every directory as the disk check proceeds. On NTFS volumes, this switch displays cleanup messages (if any).
● /R Identifies bad sectors and recovers information from those sectors if possible. The disk must be locked. Be aware that this is a time-consuming and uninterruptible process.
The following switches are valid only on NTFS volumes:
● /I Performs a simpler check of index entries (stage 2 in the Chkdsk process), reducing the amount of time required.
● /C Skips the checking of cycles within the folder structure, reducing the amount of time required.
● /X Forces the volume to dismount, if necessary, and invalidates all open file handles. This option is intended for server administrators. Because of the potential for data loss, it should be avoided in normal use with Windows XP Professional or Home Edition.
● /L[:size] Changes the size of the file that logs NTFS transactions. If you omit the size parameter, this switch displays the current size. This option is intended for server administrators. Because of the potential for data loss, it also should be avoided in normal use with Windows XP Professional or Home Edition.
Defragmenting Disks for Better Performance
On a relatively new system with a speedy processor and plenty of physical memory, hard disk performance is the single biggest bottleneck in everyday operation. Even on a zippy hard disk, it takes time to load large data files into memory so you can work with them. The problem is especially noticeable with databases, video clips, and CD images, which can easily consume hundreds of megabytes. On a 10-GB NTFS drive, the cluster size is 4 KB. On a FAT32 drive of the same size, clusters are 8 KB. Thus, when you save a 20-MB movie clip on a drive that size, Windows divides the file into approximately 2,560 pieces (NTFS) or 1,280 pieces (FAT32). When you save this file for the first time on a freshly formatted hard disk, Windows writes it in contiguous clusters. Because all the clusters that hold individual pieces of the file are physically adjacent to one another, the mechanical components of the hard disk can work very efficiently, scooping up data in one smooth operation. As a bonus, the Windows disk cache is able to anticipate the need for data and fetch nearby clusters that are likely to contain other parts of the file, which can then be retrieved from the fast cache rather than from the relatively slow disk. Unfortunately, hard disks don’t stay neatly organized for long. When you add data to an existing file, the file system has to allocate more clusters for storage, typically in a different physical location on the disk. As you delete files, you create gaps in the once-tidy arrangement of contiguously stored files. As you save new files, especially large ones, the file system uses all these bits of free space, scattering the new files over the hard disk in many noncontiguous pieces. The resulting inefficiency in storage is called fragmentation; each time you open or save a file on a badly fragmented disk, disk performance suffers, sometimes dramatically, because the disk heads have to spend extra time moving from cluster to cluster before they can begin reading or writing data.
Using Disk Defragmenter
The Disk Defragmenter utility improves performance by physically rearranging files so that they’re stored in contiguous clusters. In addition to consolidating files and folders, the utility also consolidates free space, making it less likely that new files will be fragmented when you save them. Windows XP includes a graphical utility that works as a snap-in with Microsoft Management Console. A command-line version of this utility (new in Windows XP) allows you to schedule defragmentation so that it occurs automatically, at regular intervals. For details about setting up a defragmentation schedule, see “Scheduling Tasks to Run Automatically,”
To open the graphical Disk Defragmenter console, use any of the following techniques:
● From the All Programs menu, choose Accessories, System Tools, Disk Defragmenter.
● From the My Computer window, right-click any drive icon and choose Properties from the shortcut menu. Then click the Tools tab and click Defragment Now.
● Run Dfrg.msc from a command prompt.
● Right-click the My Computer icon on the Start menu and choose Manage from the shortcut menu. In the Computer Management console, open the Storage option in the console pane and select Disk Defragmenter.
In Disk Defragmenter’s upper pane, select the disk you want to operate on. To find out how seriously fragmented the disk is currently, click Analyze. Disk Defragmenter presents a graphical fragmentation display and makes a recommendation about whether your disk needs to be defragmented. For more details about the condition of your disk, click View Report. Disk Defragmenter responds with statistics about the overall level of fragmentation and lists the most highly fragmented files.
To begin the defragmentation process, click the Defragment button. (You must be logged on as a member of the Administrators group to perform most defragmenting tasks.) While Disk Defragmenter is running, you see a graphical display that indicates the progress of the operation; use the Pause or Stop button at any time to halt the process.
Running Disk Defragmenter Using a Command Line
Disk defragmentation can be a time-consuming process, so you might not want to spend the time on a drive that is only slightly fragmented. On the other hand, any disk defragmenter will do a more thorough job—and finish its work more quickly—on a disk that is only slightly fragmented. (On a highly fragmented disk or a disk that’s nearly full, it’s probable that some large or highly fragmented files will remain fragmented even after the process has finished.) Therefore, you might want to adopt the strategy of running Disk Defragmenter routinely during hours when your computer is otherwise idle. The best way to do this is by creating a batch file that uses a command line to run Disk Defragmenter and then creating a scheduled task to run the batch file.
The command-line version of the Defrag utility uses the exact same program code as the graphical version. To use this command, type defrag d: at any command prompt, where d is the drive letter or mount point of an existing volume. You can use the following switches with the Defrag command:
● /A Analyzes the selected drive or volume and displays a summary of the analysis report.
● /V Displays complete (verbose) reports. When used in combination with /A, this switch displays only the analysis report. When used alone, it displays both the analysis and defragmentation reports.
● /F Forces defragmentation of the volume even if the amount of free space is low. The command-line Disk Defragmenter does not provide any progress indicator except for a blinking cursor. To interrupt the defragmentation process, click in the command window and press Ctrl+C. Using Disk Defragmenter’s Analysis Report, you can determine whether your page file is fragmented. Although page file fragmentation is normally not a serious issue, a severely fragmented page file can reduce your system’s performance. Disk Defragmenter cannot consolidate your page file, because Windows holds it open while you work. However, if you have more than one volume available (even if the second volume is on the same physical hard disk as your system drive), you can work around the problem as follows:
1 Open Control Panel and double-click the System icon.
2 On the Advanced tab of the System Properties dialog box, click the Settings button under Performance.
3 On the Advanced tab of the Performance Options dialog box, click Change under Virtual Memory.
4 From the list of available drives, choose a volume other than the one that holds your current page file. This drive will hold your temporary page file.
5 Choose the Custom Size option, enter settings in the Initial Size and Maximum Size boxes to match your current page file, and click Set.
6 Select the drive that contains the fragmented page file, set the Initial Size and Maximum Size boxes to 0, and then click Set.
7 Reboot to allow your system to stop using the old page file and begin using the new one.
8 Defragment the drive that previously held your page file. This consolidates the free space on that volume so that your new page file will be stored in contiguous space.
9 Repeat steps 1 through 6, this time creating a page file on the original disk and eliminating the temporary page file you created. Then reboot to allow the new, defragmented page file to take over.