Windows' Swap Files

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Windows' Swap Files

Post by Bigaldoc »

I run three OSs on two physical drives: XP on one drive and Vista and Win7 in two partitions on a big second drive.

This question is prompted by occasional defrags of those partitions. I use PerfectDisk and as near as I can find, it doesn't allow for the exclusion ("leave it alone") of the Windows swap files. I usually run my defrag of all three partitions from within XP.

It usually takes the longest amount of defrag time on the pagefile.sys and maybe the hiberfil.sys in Win7, I'm not sure of that one. Suppose one were to delete the swap files on Vista and Win7 manually before starting a defrag - is/would that be a dangerous thing to do? I'm assuming one couldn't do that in XP since it's the running system from which the defrag will be done.

Comment or suggestions welcome. And thanks...

User avatar
Leif
Administrator
Posts: 7193
Joined: 15 Jan 2010, 22:52
Location: Middle of England

Re: Windows' Swap Files

Post by Leif »

I usually set my Pagefile with a fixed min/max size so don't ever have this issue.

If necessary, I'll set it on a second partition temporarily, defrag the first, the (re)set it back on the first partition so that it always starts off as a single block.

Whether it is worth it, or actually matters, is of course another matter...
Leif

User avatar
John Gray
PlatinumLounger
Posts: 5401
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

Re: Windows' Swap Files

Post by John Gray »

I find that surprising! (Well, a couple of things...)

The pagefile.sys and hyberfil.sys files are single files. Even if Perfect Disk needs to (and can) defragment them the once, then next time round they will each be in a single extent, and so won't need defragmenting. The only time they would fragment again would be if Windows needed to increase its virtual memory space, which happens perhaps once in a blue moon! .

Nah, send Perfect Disk back and use the free Defraggler. (Or ignore the whole defragmentation matter entirely!)
John Gray

Venison is quiet deer, and quite dear.

User avatar
Leif
Administrator
Posts: 7193
Joined: 15 Jan 2010, 22:52
Location: Middle of England

Re: Windows' Swap Files

Post by Leif »

John Gray wrote:The pagefile.sys and hyberfil.sys files are single files. Even if Perfect Disk needs to (and can) defragment them the once, then next time round they will each be in a single extent, and so won't need defragmenting.
If the Pagefile is set to auto-expand mode - i.e. with different minimum and maximum sizes - then it is feasible it could be defragged to a single file when small, with other files placed after it. As soon as it expands, it will by definition need to split into multiple fragments... No?
Leif

User avatar
viking33
PlatinumLounger
Posts: 5685
Joined: 24 Jan 2010, 19:16
Location: Cape Cod, Massachusetts,USA

Re: Windows' Swap Files

Post by viking33 »

Leif wrote:... No?
Yes...but that's what John also says, "The only time they would fragment again would be if Windows needed to increase its virtual memory space."
No? :laugh:
BOB
:massachusetts: :usa:
______________________________________

If I agreed with you we'd both be wrong.

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Windows' Swap Files

Post by Bigaldoc »

John Gray wrote:... send Perfect Disk back and use the free Defraggler...
Well, I only defrag occasionally, so I won't take your advice not to bother. But, it is interesting and coincidental that while doing my Vista and Win7 partitions this morning, I "decided" to give Defraggler a try and will do so next week.

As to the other responses, I don't know how or why the swap files get fragmented but they are - I can see that in the PD graphic display and because of their size, it takes a LONG TIME "messing" with them.

My question has not yet been answered however: can one DELETE the swap files without terror or disaster striking?

User avatar
DaveA
GoldLounger
Posts: 2599
Joined: 24 Jan 2010, 15:26
Location: Olympia, WA

Re: Windows' Swap Files

Post by DaveA »

Yes you can delete them, but as soon as the machine is restarted they will be there again, if NOT sooner, unless you turned OFF the useage of them.
I am so far behind, I think I am First :evilgrin:
Genealogy....confusing the dead and annoying the living

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Windows' Swap Files

Post by Bigaldoc »

DaveA wrote:Yes you can delete them, but as soon as the machine is restarted they will be there again, if NOT sooner, unless you turned OFF the useage of them.
Thanks Dave. It's OK if they show up again AFTER I defrag 'cause they would then be "whole" and the defragger wouldn't have to deal with trying to mess with them. Next week I'll give it a try on one of my OS partitions to see how it goes. After all, I've got a nightly backup I can always restore if things go awry.

User avatar
viking33
PlatinumLounger
Posts: 5685
Joined: 24 Jan 2010, 19:16
Location: Cape Cod, Massachusetts,USA

Re: Windows' Swap Files

Post by viking33 »

Bigaldoc wrote:
My question has not yet been answered however: can one DELETE the swap files without terror or disaster striking?
I think it brings back the old discussion of "Is a pagefile, even necessary, when you have enough memory?" Or set your pagefile to just a very small size, and let it go at that.
Try reducing the pagefile size. You can always increase it.
BOB
:massachusetts: :usa:
______________________________________

If I agreed with you we'd both be wrong.