Part 2: Defragment the paging file
The steps in the previous section eliminate the possibility of your swap file becoming fragmented, but they won't cure an already fragmented one. You'll need to defragment your virtual memory for the best performance, but the good news is that you need to do it only once if you have a constant-size paging file.
There are several ways to defragment your swap file:
Use PerfectDisk
Use an advanced defragmenter like PerfectDisk, discussed in "A Defragmentation Crash Course" earlier in this tutorial. Just instruct it to defragment your system files, and it will schedule a defragmentation for the next time you start Windows.
Use another drive temporarily
If you have more than one partition or hard disk in your system, start by moving your swap file to a different drive letter, as described in the previous section. Then, open a Command Prompt window (cmd.exe) and type:
defrag c: /x
to defragment the free space on the drive. See "A Defragmentation Crash Course" earlier in this tutorial, for more on this tool.
When it's done, move the swap file to its new home, where it will rest nicely in the newly-allocated contiguous block of free space.
Turn off virtual memory temporarily
If you don't have a second drive, your other choice is to disable virtual memory altogether by clicking No paging file and then Set in the Virtual Memory window. After restarting Windows, run Disk Defragmenter as described above to set aside a large chunk of contiguous free space. When you're done, go back to the Virtual Memory window, and re-enable the paging file, making sure to set a constant size.
Clear the paging file automatically
See "Part 3: Clear the paging file on shutdown", next, for another way to reduce fragmentation in your paging file.
In this tutorial:
- Windows 7 Performance
- Trim the Fat
- Tame Mindless Animation and Display Effects
- Make Menus More Mindful
- Start Windows in Less Time
- Eliminate unnecessary auto-start programs
- Clean out your Temp folder
- Start Windows Instantly (Almost)
- Put your PC to sleep
- Sleep and Hibernate troubleshooting
- Shut Down Windows Quickly
- Start Applications Faster
- Make Your Hardware Perform
- Windows 7 Get Glass
- Maximize the Windows Performance Rating
- Improve Battery Life
- Manage IRQ Priority
- Overclock Your Processor
- Hard Disk
- A Defragmentation Crash Course
- Enable automatic boot defragments
- If in Doubt, Throw It Out
- Optimize Virtual Memory and Cache Settings
- Part 1: Virtual memory settings
- Part 2: Defragment the paging file
- Part 3: Clear the paging file on shutdown
- Part 4: Advanced settings for the adventurous
- Choose the Right Filesystem
- Convert your drives to NTFS
- Advanced NTFS Settings
- Transfer Windows to Another Hard Disk
- What to look for in a new hard disk
- Work with Partitions
- The Disk Management nickel tour
- Create and delete partitions
- Resize and move partitions
- Alternatives to Disk Management
- Different ways to mount a volume