Page file fragmentation

Skyhooker

Member
Reaction score
9
Location
Dundee, Illinois
I'm working on a computer with a badly fragmented page file (see my "Accidental repair" post in this forum), and I'd like to know the best way to defragment it. I have the Sysinternals utility, "pagedrfg.exe", which sounds like the safest method, but I believe I could also simply select the "no page file" option for the drive, reboot, then change that back to some manual or automatic page file management option. Any caveats or recommendations on either method?

Thanks,


Sky
 
Using the pagefile defrag can (and has) also crash a rig, so either way it would potentially have ended poorly. ;)
 
I normally use the deletion and recreation method.

If you want to play ultra safe with this, simply temporarily add another drive and put the old page file there until you have wiped and restored the C drive one.
 
What I'm wondering is if there is any point to doing it at all for your average desktop machine.

Bearing in mind it's just a dump of random access memory, does it need to be a contiguous file? And how long would it remain defragmented for?
 
What I'm wondering is if there is any point to doing it at all for your average desktop machine.

Bearing in mind it's just a dump of random access memory, does it need to be a contiguous file? And how long would it remain defragmented for?

Well, here's what I believe, and maybe others can correct me or verify: if virtual memory is set to a fixed size from the beginning and disk space allows it to be created contiguously, it will never become fragmented. If Windows is allowed to manage the size and there is no longer space to make it contiguous, then the additional pieces that are created as needed will be scattered all over the drive. If you later set a fragmented page file to a fixed size, then the pieces will remain fragmented, and cannot be moved while Windows is running. That's why you need a utility that will defragment it prior to boot-up and before Windows locks it. You need to defragment the drive enough to make a free space large enough for whatever fixed page file size you choose to be contiguous, then either defragment it or delete it by selecting "no page file" for the drive, rebooting, and then creating it in whatever size you need.

Am I understanding all this correctly?

Another thing I just learned about defragmenting is that, if you have a hyberfil.sys as scattered as this one was, the best thing is to delete it by disabling hybernation in the power options, defragmenting the drive, then re-enabling hybernation if desired, similar to page file above.

So I think there is a point in it for the average desktop, especially those that are or have been filled close to capacity (remember that this one had <1MB left, and Windows and the drive were surely overworked allocating space). Not only is the performance orders of magnitude better on this computer, but bugs that had apparently been caused by the overfilling of the drive have disappeared.
 
Sky you are pretty much on the nose there, except why would you have a hibernation file on a desktop? Actually I try to persuade clients to ban these on laptops too as sooner or later they bring grief.

Another way to avoid fragmentation of a page file is to create a dedicated partition for it, and not have it on the C drive at all. There was a time when this was common for commercial systems admins to do this. This method also bring some performance improvement although whether it is worth it with modern processors is debatable.
 
Sky you are pretty much on the nose there, except why would you have a hibernation file on a desktop? Actually I try to persuade clients to ban these on laptops too as sooner or later they bring grief.

Oh, maybe I wasn't clear - it's a Dell Inspiron laptop. I might have mentioned the word "desktop" somewhere referring to the trouble I had making changes to the Windows desktop for one of the users. I think I'll recommend that we disable hybernation. As you say, sooner or later... :eek:
 
Back
Top