Disk Defragmenter in Windows 2000: Maintaining Peak Performance Through Defragmentation

Microsoft® Windows 2000 Knowledge Center

Windows 2000 Disk Defragmenter

If you have arrived here through a search engine, click here!

Maintaining Peak Performance Through Defragmentation

This article will provide you with an overview of disk fragmentation process as well as related issues that may be encountered when performing this task. The following explains the overall purpose and functionality of Disk Defragmenter, the manual defragmentation utility included with the Windows® 2000 operating system.

Contents

Introduction

It’s essential that your hard disks be maintained at peak levels of reliability and performance. The Windows® 2000 operating system does this through a built-in system tool called Disk Defragmenter. This tool was developed through a joint collaborative effort between Microsoft Corporation and Executive Software International. We have broken the subject of defragmentation into segments to provide you with a better view of their impact on your system.

Types of Fragmentation

Hard drive fragmentation occurs for many reasons, such as the creation and deletion of files and folders from your drive, the installation of new software, even reviewing Web pages and downloading files from the Internet. Computers do not always save an entire file or folder in a single space on a disk, instead they are saved in the first available space. After a hard drive has been in use for a while, many files and folders are saved in pieces spread across the hard drive. Note, in Windows NT parlance, this is referred to as a volume, therefore the terms disk and volume are used interchangeably. As you delete files or folders, those empty spaces left behind are filled randomly as you add new files and folders. This random filling is fragmentation. As the drive becomes more and more fragmented, the slower your computer’s file input and output performance will be. Think of those files and folders as puzzles. When you save one to your hard drive, your system breaks that big puzzle down into pieces and stores the pieces in vacant spots across the drive. When you later access that large file, your operating system must reassemble all of those puzzle pieces to provide you with a complete file. The more pieces to assemble, the more time it takes to reassemble them. There are two main types of disk fragmentation: file fragmentation and free space fragmentation.

File Fragmentation

If your system is able to store a file with all of its parts in one continuous segment on a hard drive, this is referred to as “contiguous.” When your system is unable to store a file in a continuous state (the file is not contiguous), it’s considered to be fragmented; broken into pieces that are scattered across the drive or volume. All Windows® file types, both (FAT) File Allocation Table and (NTFS) NTFS file system files are susceptible to fragmentation.

File fragmentation has a negative effect on system and drive performance because the arm and head of the hard drive will require more time to move to across different segments of the drives disk surface to read and collect the scattered file fragments. This is the main reason a system begins a slow and gradual degradation of performance over time if you do not defragment the drive. As the drive becomes heavily fragmented, data reads will take longer and longer, and even the length of time necessary for the start and restart of your system will be effected.

Free Space Fragmentation

If your computer system had a 20G hard drive, and you have used 10G of it, or about half, the unused space would be referred to as free space. If computer systems were perfect, this unused space would always be available in a contiguous form on your drive. Unfortunately systems are not perfect, and while it’s good to have free space, it’s not good if it’s fragmented. In the same scenario, if you were to check the properties of that 20G hard drive, you would see that about 50% is available. Don’t jump with joy just yet! That total space available is usually comprised of all of the tiny free space fragments spread across your entire hard drive. This is “free space fragmentation”. In an ideal situation, operating systems would detect or sense this type fragmentation and join all of these tiny segments into one contiguous segment. Unfortunately we’re not there yet. This free space fragmentation lends itself easily to file fragmentation, a kind of vicious circle.

What Is Defragmentation

Defragmentation is the process of rewriting non-contiguous parts of a file to contiguous sectors on a drive for the purpose of increasing data access and retrieval speeds as well as overall system performance. Because FAT and NTFS file systems can become badly fragmented over time, defragmentation is vital for optimal system performance.

Employing Good Housekeeping

File fragmentation began the very first time your computer system was started by the manufacturer, because loading the operating system results in both file and free space fragmentation. You can test this for yourself by loading the Windows 2000 operating system onto a new machine, and then run the analysis function of Disk Defragmenter as shown below.

For both the individual and corporate user, Disk Defragmenter should be run right after the operating system is loaded, and then manually at regular intervals thereafter depending upon system usage. Deciding when to defragment your disk will largely depend on the type of work you do, keeping in mind that normal, day-to-day use of your computer will cause fragmentation. If you do allot of graphics design, Web site building, Web surfing, compress and decompress files, file editing or install and uninstall applications, consider defragmenting your drive once a week for moderate to heavy use, and bi-monthly or monthly for intermittent use.

You can use the Disk Defragmenter tool to analyze disks before deciding whether or not to defragment them. After analyzing a disk, you will see a dialog box that will advise you of the percentage of fragmented files and folders on the drive or volume along with a recommended course of action. You should use the analyze feature regularly and defragment drives hen Disk Defragmenter recommends it. Performing disk analysis and defragmentation on all Windows 2000 based servers and workstations will ensure that drives are operating optimally.

Practicing Safe Defragmentation

During the development of the earlier versions of Windows NT, especially NT 4.0, defragmentation application programming interfaces (APIs) were developed and built into Windows NT that ensured that files could be moved safely without the possibility of data loss, system crashes, or corruption, all while the operating system was running. During the development of Windows 2000, these defragmentation APIs were enhanced even further, and then tested and certified by Microsoft to make certain that files created using Windows 2000 could be defragmented without risk. While this may work in a development and test environment, it may not work in all environments, therefore we recommend that, if should your environment involve mission critical tasks, applications and data, always perform a backup prior to, and as part of, the defragmentation process.

Disk Defragmenter In Action

The Windows 2000 Disk Defragmenter interoperates with the file system and application programming interfaces to ensure that drive and file integrity is maintained.

The Disk Defragmenter:

  1. Locates the fragments of each file throughout the disk.
  2. Copies them contiguously to a new location.
  3. Verifies that the copy is an exact duplicate of the original.
  4. Updates the Master File Table (MFT) so that the new file location is set.
  5. De-allocates the old location and reclassifies it as free space.

Points to Keep in Mind

  • Your operating systems file system takes care of all data movement, not the Disk Defragmenter tool.
  • The application programming interfaces do not support defragmentation of the MFT, the Paging File, FAT directories, or files open for exclusive us, such as the Windows registry.
  • The NTFS directories can be defragmented in Windows 2000.

Important Elements of the Disk Defragmentation Process

To maintain optimum efficiency of your drive, you need to understand these Key Elements and how they are managed:

Master File Table

The NTFS file system relies on a file called the Master File Table (MFT). The MFT consists of an index file, or map, of everything stored on a drive. There is at least one entry in the MFT for every file on an NTFS disk, in addition to the MFT itself. For each entry in the MFT, you will find: the size; time and date stamp; the security attributes; and the location of the data.

Because the MFT is constantly being used to access all other files on the disk, it also gradually becomes fragmented, resulting in longer disk access times and diminished performance. Disk Defragmenter, however, cannot defragment the MFT once it becomes fragmented. NTFS minimizes this impact by reserving one-eighth of the total disk space for the exclusive use of the MFT. This area of the disk is known as the MFT Zone, and Windows 2000 uses it to keep the MFT as contiguous as possible as it grows.

Paging File

The Paging File (also known as the swap file) is the disk space that Windows 2000 uses to swap data in and out of Random Access Memory (RAM). When virtual memory requirements exceed the amount of physical RAM, the Virtual Memory Manager transfers the oldest data stored in RAM to the Paging File. This makes physical RAM, the faster of the two RAM types, available for higher priority uses. When the Paging File becomes fragmented, performance degrades severely due to increased disk input and output times.

When you first start Windows 2000, it first allocates disk space to the MFT and the Paging File for their exclusive use. You must keep in mind that application programming interfaces (APIs) that enable safe defragmentation do not support the movement of these files, therefore these specific files cannot be moved safely. The only way to defragment the MFT and the Paging File is when Windows 2000 is not running. The best solution is to defragment the MFT and the Paging File during boot time, however since this is beyond the capabilities of the Defragmentation tool included with Windows 2000, it is recommended that you use a third-party, enterprise-level defragmenter.

Hibernate File

The Hibernate File is that part of the drive space where memory data is stored when the computer is turned off. Since the location of the Hibernate File is set during the boot process, it cannot be moved. It can, however, be defragmented, but not with the Windows 2000 Defragmentation tool. You will need to perform this type of defragmentation during boot time using a third-party, enterprise-level defragmenter.

Directories

Directories can and do become fragmented, which adds to the time necessary to boot the system as well as the time necessary to access files while working on the system. The Windows 2000 directories, on an NTFS disk, can be defragmented while the operating system is running. However, FAT directories can only be defragmented at boot time.

Using the Windows 2000 Disk Defragmenter

The Disk Defragmenter tool supports FAT 16, FAT 32, (with some limitations) and NTFS (which supports compressed and encrypted files). It includes an analysis program that demonstrates the level of disk fragmentation along with a display that illustrates the condition of the disk before and after the defragmentation process. For the average individual user, the Disk Defragmenter is more than adequate for the job of maintaining higher levels of disk performance. For enterprise level users, or those involved with heavy graphics, Web building and the like, a third party defragmenter is recommended.

Operating the Disk Defragmenter

The following steps detail how to use Disk Defragmenter:

  1. Click Start, point to Programs, point to Accessories, point to System Tools and click Disk Defragmenter.

    Figure 1

  2. Select the volume(s) that you want to check for fragmentation.
  3. Click Analyze and wait for the message box to find out whether or not you need to defragment.

    Figure 2

    Analyze and Defragment

    Analyze is a diagnostic tool that examines the condition of the disk you’ve selected, and let’s you know if you need to defragment your disk(s). After using Analyze in the example illustrated below, in turns out that defragmentation of volume (C:) is not necessary. If it was necessary to defragment the disk, the message box would indicate so, and you would only need to press the Defragment button and the defragmentation process would begin automatically.

  4. If you need to defragment, click Defragment.

    Note: While it’s possible to do other tasks while Disk Defragmenter is defragmenting a volume, it’s not recommended. This is because the defragmentation process may reduce overall system response time. It is recommended that you run Disk Defragmenter when you’ve finished using the computer for the day.

  5. When the defragmentation process is completed, select the next drive or volume (if any) to defragment, until all drives or volumes are defragmented and consolidated.

    Whether you’re analyzing or defragmenting a drive or volume, Disk Defragmenter works on only one drive or  volume at a time, and each one must be manually selected by clicking it. After choosing a drive or volume, along with the process you wish to perform, you will see a display illustrating the disk’s current state of fragmentation.

Understanding the Color-coded Display Map

Disk Defragmenters color coded illustrations show how different file types and free space are organized on a drive or volume. Fragmented files are coded red; contiguous files are blue; and system files, which include both the MFT and Paging File are green. Free space is indicated in white. The size of each colored segment is indicative of how much space, along with its relative position, each element occupies on a disk or volume.

It is important to note that this color coded illustration is only an approximation of the disk’s condition. You are reviewing a graphical display of pixel-width lines. In this respect, there are 72 pixels to an  inch, which can represent thousands of disk space clusters, some of which may contain a mix of fragmented files, contiguous files, free space, and system files. Because it is an approximation, the Disk Defragmenter graphical display can illustrate a somewhat skewed representation of the actual condition of the disk. After you successfully defragment the disk, the color display will present a more accurate representation of the condition of the disk, and the amount of free space represented will be more accurate.

Defragmentation Requires Adequate Disk Space

All to often, systems are operated for moths without being defragmented, which may later cause problems when you attempt to do so. If the drive or volume you intend to defragment is already highly fragmented, there may be insufficient free space on that disk to effectively run the defragmentation process. This is due to the fact that a complete copy of the defragmented files are made in the new, defragmented, location before the original clusters are marked free.

After defragmenting a disk , Disk Defragmenter may still report: “It is recommended that you defragment this disk.” This indicates that there is too little free space to effectively perform the defragmentation routine. If this occurs, do one of the following:

  • Move large files and folder off of the drive or volume, such as My Documents, My Pictures etc.
  • Run completed Disk Cleanup on the system to remove as many temporary files as possible.
  • Remove as many other files as you can that you no longer need.
  • If necessary, temporarily uninstall some applications until you can complete a defragmentation.

Calculating The Free Space Required

You may recall for our discussion above describing the Master File Table, one-eighth of a disk is allocated to the MFT zone. Even though this space is marked as free space, it is reserved by Windows 2000 for the exclusive use of the MFT. The Disk Defragmenter cannot take advantage of this space by moving files into the MFT zone, therefore when you calculate the amount of free space available for defragmentation, you must subtract one-eighth, or about 12 percent, from the free space reported by Windows Explorer. Actually, it is recommended that you maintain between 25 and 35 percent of any NTFS drive or volume as free space to ensure that you have the required space for successful defragmentation.

Conclusion

As you can see, drive or volume fragmentation can negatively impact an operating systems speed and performance. At times, this impact can be so severe that it will have every appearance of a hardware related problem. By not following a regimen of routine defragmentation to maintain peak performance, the condition of your drives or volumes could degrade to the point where they cannot be effectively defragmented, resulting in the need for some other form of drastic action to return the system to optimum performance levels.

The included Disk Defragmenter was designed primarily for stand-alone machines and requires Administrator privileges to implement. Administrators who require defragmentation of heavy-use systems or enterprise level systems, should consider a third-party, utility.

The Files Excluded by the Disk Defragmenter Tool

This tool excludes a number of specific files as there are known issues regarding problems that occur when they are moved. In addition, any files that are “locked” by a running process are skipped. The following files cannot be defragmented, and will be displayed in the analysis report as still being fragmented regardless of how many times you defragment the drive.

Moving the following file can cause desktop problems, if the Recycle Bin or the Recycler folders are removed:

%SystemRoot%\ShellIconCache

Moving the following files (if present) can cause desktop problems:

  Safeboot.fs
  Safeboot.csv
  Safeboot.rsv
  Bootsec.doc

The following system files must not be moved. They are always displayed in green in the analysis display:

  • NTFS Master File Table (MFT) and Reserved MFT Zone: Usually contiguous at the very beginning of a NTFS volume but can become fragmented if many files and folders are added to a volume.
  • NTFS Master File table Mirror (MFTMirr): Usually located in the middle of a volume and is already contiguous.
  • Virtual Memory Paging file: Used for temporarily swapping pages of memory to disk.

Adjusting the Master File Table

Although you cannot defragment the MFT once it becomes fragmented using the Disk Defragmenter, there is a way of preventing MFT fragmentation, or at least reducing the fragmentation that does occur, and that is by reserving space for it ahead of time.

To determine how large the MFT is, how many fragments there are, and what percentage of the MFT is in use on an NTFS volume, perform an analyze operation to generate a report. View the report and look for the following section under Volume Information:

  Master File Table (MFT) fragmentation.
  Total MFT Size = 8512K
  MFT record count = 8,504
  Percent MFT in use = 99%
  Total MFT Fragments = 4

Use this information along with this article in the Microsoft Knowledge Base, “How NTFS Reserves Space for its Master File Table (MFT)” to adjust the NtfsMftZoneReservation value, back up and reformat the volume to create a contiguous MFT using the higher zone reservation space, and then perform a full volume restore.

Defragmenting the Paging File

To defragment, or reduce the amount of fragmentation in the paging file:

  1. Click Start, point to Settings, click Control Panel, and then double-click System.
  2. On the Advanced tab, click Performance Options.
  3. Click Change to open the Virtual Memory dialog box.
  4. Change the paging file to another drive.
  5. Reduce the minimum and maximum size of the original paging file on the drive you want to defragment to 0 MB.
  6. Restart your computer to have the system use the new paging file.
  7. Run Disk Defragmenter on the original drive to consolidate the free space segments created by moving the paging file.
  8. Re-create the paging file on the original drive.
  9. Reduce the minimum and maximum size of the temporary paging file to 0 MB.
  10. Restart your computer.

Would a more illustrated version of the above be more helpful to you? If so, click here.

Notice: Windows® 95, Windows® 98, Windows® NT, Windows® 2000 and
Microsoft® Office are registered trademarks or trademarks of the Microsoft Corporation.

About Dewwa Socc

Sahifa Theme License is not validated, Go to the theme options page to validate the license, You need a single license for each domain name.