tllcurv.gif (1047 bytes)  

 

 

 

 

 

Home

Free Downloads

Product FAQs (NT)

Product FAQs (OpenVMS)

Product Alerts

Technical References

Links

brlcurv.gif (1043 bytes)

Paging File and Pagefile Defragmentation

Paging file fragmentation can impact system performance. How muchdepends on system configuration and use. Here is a guide to how much of a problem paging file fragmentation canbe, along with some solutions.

Impact on the System

Paging file fragmentation can affect your system in two ways. Firstand worst, it indirectly slows your system by preventing files from being created contiguously and by making itharder to defragment them later. This is because the paging file fragments, being scattered all over the disk,break up the free space so there isn't any single space big enough to hold the larger files. It can then take significantlylonger to write new files and read existing ones and your overall performance drops. Since the paging file is lockedby Windows NT, it can't be moved or defragmented, so Diskeeper cannot do anything about it.

Second, paging activity can be slowed down, depending on the degreeof paging file fragmentation. If the paging file fragments are larger than 64 kilobytes each, fragmentation isn'ta problem, because only 64 kilobytes (the system limit) are read at one time. So, even if you had a 100-megabytepaging file in one large contiguous location, it would still take 1,500 I/Os to read the whole thing. But, if thefragments are smaller than 64 kilobytes, then you will have multiple I/Os just to read one chunk of data. Additionally,the data itself isn't necessarily contiguous; for example, if a program has 60 kilobytes stored in the paging file,the data may reside in three widely separated 20-kilobyte pieces. With an extremely fragmented paging file, say100 megabytes in size, with ten thousand fragments, there is a very noticeable lag every time it is accessed, sinceeach paging file fragment averages only 10 kilobytes.

On most systems, the paging file has different Initial and Maximumsizes. Until the Initial limit is reached, the file usually tends to be contiguous, because the Initial limit spaceis created all at one time, but after the Initial limit is reached, the additional parts of the paging file tendto be fragmented, because no space has been created in advance. This is done in an effort to save disk space, asthe additional space (the Maximum setting) may never be used. Thus the first data to go into the paging file ismore likely to be contiguous, and can be read with a single I/O. The later data may be fragmented and take longerto retrieve.

Next, you need to consider how often the paging file is used. An averagebusiness Windows NT site has many processes running simultaneously, or the machine is a server serving many users,or runs memory-intensive applications such as graphics or video. In such a case, a fragmented paging file may impactperformance, depending on usage and other factors. Of course, if you only run one application at a time and thatapplication doesn't use much memory, you may never use the paging file at all and paging file fragmentation isnot worth spending any time handling.

Defragmenting the Paging File

The paging file is open for exclusive use by the Windows NT system.While Diskeeper cannot currently defragment it, there are ways to defragment the paging file, or at least reducethe degree of its fragmentation.

This method is fairly simple, but requires having more than one partition,and you need Diskeeper 2.0 or later, or Diskeeper Lite:

  1. Create a new, temporary paging file on another partition.
  2. Set the fragmented paging file Initial and Maximum sizes to zero.
  3. Reboot.
  4. Run Diskeeper in the Manual mode on the partition where the originalpaging file resided. You may have to run it two or three times to consolidate the free space.
  5. Recreate the paging file on the original partition.
  6. Set the Initial and Maximum sizes of the temporary paging file tozero.
  7. Reboot. This activates the new paging file on the original partition.

Use the following method if you only have a single partition. Thisalso requires Diskeeper 2.0 or later, or Diskeeper Lite:

 

  1. Set the fragmented paging file Initial and Maximum sizes to zero.
  2. Reboot. Since you no longer have a paging file, you will be warned;ignore the warning but be aware that your system performance will temporarily be slowed until you recreate thepaging file.
  3. Run Diskeeper in the Manual mode. You may have to run it two or threetimes to consolidate the free space.
  4. Recreate the paging file on the original partition.
  5. Reboot. This activates the new paging file on the original partition.

Or use this alternative method:

  1. Create a new file, e.g. C:\pagefil2.sys. It can be a zero lengthfile.
  2. Update the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Sessionmanager\Memory Management\PagingFiles to change C:\pagefile.sys to the new file name.
  3. Reboot. The new file is now being used as the pageing file.
  4. Defragment the disk; this will now be able to defragment the originalpage file.
  5. Change the registry value back to C:\pagefile.sys
  6. Reboot.
  7. Delete the tempory alternative page file.

If you are running Diskeeper 1.0x:

  1. Create a new temporary paging file on another partition. If you onlyhave a single partition, skip to Step 2.
  2. Set the fragmented paging file Initial and Maximum sizes to zero.
  3. Reboot. If you did not create a temporary paging file, you will bewarned that no paging file exists. You can ignore the warning but be aware that your system performance will temporarilybe slowed until you recreate the paging file.
  4. Manually create a new file on the partition where the fragmentedpaging file existed. Make it as large as you want the paging file to be, and name it pagefile.sys. (A file canbe "created" by copying an existing file of the size required and renaming it pagefile.sys.)
  5. Run Diskeeper on the original partition until the new file is contiguous.
  6. Recreate the paging file on the original partition. You will be warnedthat a file named pagefile.sys already exists, and will be asked if you want to overwrite it. Do so.
  7. Reboot. This activates the new paging file.

Other Useful Points

A paging file can be created with different Initial and Maximum sizes.The advantage of this is having a higher paging file capacity available without permanently using disk space. However,with hard disk prices as low as they are now (and still dropping), this is not much of a concern any longer. Werecommend that you set the paging file Initial and Maximum sizes to the same value. This prevents the paging filefrom fragmenting in the future.

The paging file can reside on any partition, and you can have as manypaging files as you have partitions. The ideal arrangement is one large paging file for each disk controller. Thisgives you the fastest access. Next best is one paging file per disk. This is less than ideal only because the controllercan only access one disk at a time, so it's a little slower. Third in rank is having more than one paging fileon a single hard disk. This can be much slower because the read/write head has to move from one partition to anotherif both paging files need to be accessed.

If you have a paging file on the system partition that is larger thanthe total amount of system memory, then, if a blue screen crash should occur, the contents of the memory will bewritten to the paging file. This can be very useful for determining why the crash occurred.

Paging files are an efficient way to get some benefit from spare diskspace. You should keep at least 20% free space (Microsoft is currently recommending 25%) on each partition, asperformance drops off rapidly as the disks become fuller. If you have even more free space, you can make additionalpaging files (but only one per partition). If you run memory-intensive applications such as document scanning,five or six hundred megabytes of extra paging file can dramatically increase your throughput.

 

If you have any comments about this article orany requests for new technical articles e-mail

 

Executive Software Europe