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

Performing Routine Maintenance - Defragmenting Disks for Better Performance

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/13/2011 9:46:54 PM
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 with a zippy hard disk, it takes time to load large data files into memory so that you can work with them. The problem is especially noticeable with movies, video clips, DVD-burning projects, databases, ISO image files, and virtual hard disks, which can easily take up multiple gigabytes, sometimes in a single file.

On a freshly formatted disk, files load fairly quickly, but over time, performance can degrade because of disk fragmentation. To understand how fragmentation works, it helps to understand the basic structure of a hard disk. The process of formatting a disk divides it into sectors, each of which contains space for 512 bytes of data. The file system combines groups of sectors into clusters, which are the smallest units of space available for holding a single file or part of a file.

On any NTFS volume greater than 2 GB in size, the cluster size is 4 KB. Thus, when you save a 200-MB video clip, Windows divides the file into roughly 50,000 pieces. When you save this file for the first time on a freshly formatted, completely empty 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 hard disk's onboard cache and the Windows disk cache are 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 fast cached memory 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.

The Disk Defragmenter in Windows 7 improves on earlier versions in many ways, not the least of which is you shouldn't need to do anything to benefit from it. Disk Defragmenter runs as a low-priority background task that kicks off once a week, in the middle of the night, without requiring any attention from you.

21.4.1. 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. The Disk Defragmenter process starts according to a schedule that you can adjust. To view the current settings, click the Disk Defragmenter shortcut (in the System Tools subfolder of the Accessories folder on the All Programs menu), or right-click any drive icon in the Computer window and click Defragment Now on the Tools tab.

Figure 1 shows the simple Disk Defragmenter interface. The Schedule section of the dialog box shows whether scheduled defragmentation is on or off and when the next run is to occur. The Current Status section shows the date and time of each disk's most recent defragmentation. Buttons let you reconfigure the schedule, analyze a selected disk to see how fragmented it might be, and perform an immediate defragmentation.

Figure 1. The Disk Defragmenter dialog box lets you see at a glance when the utility is set to run and when it last performed.


Click Configure Schedule to change when Disk Defragmenter runs automatically. By default, the utility runs weekly, at 1:00 A.M. each Wednesday. You can schedule operation to be daily, weekly (you pick the day of the week), or monthly (you pick the date), and you can choose the time of day (round numbers only), as shown in Figure 2.

Figure 2. Pick a daily, weekly, or monthly schedule for Disk Defragmenter to begin running as a background task.


If your computer is off at the appointed time, Disk Defragmenter will run at the first idle time after it's back up again. If your computer is nearly always either off or in use at 1 A.M., you might want to reconfigure the schedule. Choose a time when the machine is usually on but not in use—a regular lunch break, for example.

If your computer has more than one hard disk (more precisely, more than one volume, because each hard disk can be partitioned into multiple volumes), you can specify which ones you want Disk Defragmenter to act upon. Click Select Disks to display the dialog box shown in Figure 3, in which you can remove the check mark from any volumes you don't want to defragment.

Inside Out: Dedicate a partition for CD or DVD burning

The best way to avoid disk fragmentation is to start with a completely clean slate. If you routinely work with CD images, for instance, consider creating a separate partition that's big enough to temporarily hold the files you're working with. A 2-GB partition, for instance, is big enough to hold a CD image and all temporary files associated with it. (You'll need roughly 10 GB for a DVD-burning partition.) Keep that drive empty except when you plan to create a CD, at which time you can copy files to it for burning. Using this strategy, you can be certain that fragmentation won't have a deleterious impact on your CD-burning performance.


Figure 3. Selecting Automatically Defragment New Disks causes Disk Defragmenter to include any hard disks you add to your system in its routine.


2. Running Disk Defragmenter from a Command Line

The command-line version of Disk Defragmenter allows you to exercise fine-grained control over the defragmentation process, and it uses the exact same program code as the scheduled version. To use this command for a specific drive, type defrag d: in an elevated Command Prompt window, where d is the drive letter or mount point of an existing volume. To see the full range of the Defrag utility's capabilities, type defrag /?. Among the more useful switches are the following:

  • /c Defragments all volumes on the computer. Use this switch without specifying a specific drive letter or mount point.

  • /a Analyzes the specified volume, and displays a summary of the analysis report.

  • /f Consolidates the free space on the specified volume, reducing the likelihood that large new files will be fragmented.

  • /r Defragments multiple volumes in parallel. If your volumes are on physically separate disks, you might save a bit of time by using this switch.

  • /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.

In addition to the documented switches listed, the command-line Defrag utility includes this useful but undocumented switch:

  • /b The /b switch optimizes boot files and applications while leaving the rest of the drive undisturbed.

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 Prompt window and press Ctrl+C.

TROUBLESHOOTING

The Disk Defragmenter utility does not fully defragment the drive

A volume must have at least 15 percent free space before Disk Defragmenter can completely defragment the volume. If you have less free space available, the operation will run, but only partial defragmentation will result. From a Command Prompt window, run Defrag with the –a switch to see statistics (including free space) regarding the specified volume.

You cannot defragment a volume that Windows has marked as possibly containing errors. To troubleshoot this possibility, type chkdsk d: /f at any command prompt, substituting the letter of the drive in question. Chkdsk will report and repair any file-system errors it finds (after restarting, in the case of a system or boot volume).

Disk Defragmenter does not defragment files in the Recycle Bin. Empty the Recycle Bin before defragmenting.

Additionally, Disk Defragmenter does not defragment the following files: Bootsect.dos, Safeboot.fs, Safeboot.csv, Safeboot.rsv, Hiberfil.sys, and Memory.dmp. In addition, the Windows page file is never defragmented. (See the "Defragmenting Particular Files" sidebar to learn how to work around this issue.)

Disk Defragmenter ignores fragments that are more than 64 MB in size, both in its analytical reports and in operation. According to Microsoft's benchmarks, fragments of this size (which already consist of at least 16,000 contiguous clusters) have a negligible impact on performance. Thanks to disk latency, a large file divided into 10 fragments of 64 MB or greater in size will not load measurably slower than the same file in a single unfragmented location; under those circumstances, it's best to leave the fragments alone.

Disk Defragmenter will pass over any files that are currently in use. For best results, shut down all running programs before running the utility. For even better results, log off and log back on (using an account in the Administrators group) before continuing.


Inside Out: Defragmenting particular files

Do you still want to defragment files larger than 64 MB, despite Microsoft's assurance that those files don't need defragmenting? Mark Russinovich's Contig utility, a free download from Microsoft's Sysinternals website (w7io.com/2105) will do the job. Contig is a file-specific defragmenter. You can use it to analyze and defragment individual files or groups of files meeting wildcard specifications.


3. Defragmenting Solid-State Media

Because flash disks and other solid-state media don't employ moving parts to save and retrieve data, file fragmentation on these drives is likely to impose a smaller performance penalty than it does on rotating media. For this reason, as well as to avoid decreasing performance lifespan, Disk Defragmenter does not perform scheduled defragmentation of solid-state drives. You can still defragment a solid-state drive if you choose, but only on an ad hoc basis. To do this, run Disk Defragmenter, select the disk you want to defragment, and then click either Analyze Disk or Defragment Disk.

Other -----------------
- Performing Routine Maintenance - Checking Disks for Errors
- Performing Routine Maintenance - Keeping Your System Secure with Windows Update
- Performing Routine Maintenance - Introducing Action Center
- Using Internet Explorer 8 : Security and Privacy Options (part 4)
- Using Internet Explorer 8 : Security and Privacy Options (part 3) - Using Scripts Wisely & Managing Cookies
- Using Internet Explorer 8 : Security and Privacy Options (part 2) - Protecting Yourself from Unsafe and Unwanted Software
- Using Internet Explorer 8 : Security and Privacy Options (part 1) - Working with Protected Mode & Using and Customizing Internet Security Zones
- Personalizing Internet Explorer (part 2) - Managing Toolbars, Managing and Troubleshooting Add-ons & Using (or Refusing) AutoComplete
- Personalizing Internet Explorer (part 1) - Adding, Removing, and Managing Search Providers & Configuring Accelerators
- Using Internet Explorer 8 : Working with RSS Feeds and Web Slices
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server