View Full Version : pagefile.sys/swapfile conundrum

Billy T
25-11-2003, 05:26 PM
Hi Team

I was busy doing a ghost image of my C: drive to back up the latest changes and program additions, and I just had an interesting thought. :O

I have been excluding the swapfile (and a range of other stuff) from my backup boot disk routines to reduce the size of the images created, and crossed fingers, I have not had to use any of them yet.

My question is this: With no swapfile present on the image, will Windows recreate that file when I reboot?

My guess is that it will, but I'd like something better than a guess. :|


Billy 8-{)

[b][pre]Oh yes, I do this on W98 and W2K (win386.swp & pagefile.sys)

25-11-2003, 05:57 PM
You can set Windows to clear the swap file when shutting down, it may pay to do this with each ghost image you make (Eg, set it to do that so it clears it on shutdown, and re-enable it after Ghost has run).

Should be smart enough to re-create it itself though :-)

25-11-2003, 06:48 PM
keep the swapfile there just make it zero in size ;-)

Billy T
25-11-2003, 10:16 PM
Thanks tweak'e

I kinda figured that might be the answer.

I have since thought about adding a routine to my Ghost boot disk to restore an empty file in the appropriate directory because that might be less complicated than having to reduce the file to zero before imaging then going through a double boot process to restore the image, expand the file size then activate it.

Any views on that idea?


Billy 8-{)

25-11-2003, 10:43 PM
Win 9x will recreate it (I've deleted it thru DOS before). I'm not sure about NT, but I assume it would.

BTW, wow, you actually do backups!

25-11-2003, 11:31 PM
Not sure if this will help, but win nt unlike 98 can run without a swap file the draw back is you need more than 512MB of ram. So if this is your sit then you can just turn the swap file off, I have 1GB of ram on my server and WinXP pro box and no swap on ether they appear to run better without it. Worth a shot. If its 98 then reducing it to 0 is a good idea as mentioned earlier by someone else.

Goodluck let us know how you get on..

25-11-2003, 11:44 PM
Despite the obvious security benefits of having the pagefile cleared at shutdown/reboot, it does for some reason lengthen the shutdown process.

I can't for the life of me figure out why that happens (unless Windows does three-pass wiping of the contents of the file :O), but I found it slightly annoying after a while. And seeing as I had enabled it via a registry edit mentioned in PC Authority, it took me two emails to PC Authority to find out how to disable it (because I was expecting a reply by email, not my question being answered in the magazine - which, upon examination of a particular issue, appears to be the case). And then last week I discovered the damned setting in the Local Policy Editor thingie :D

If you're not incredibly paranoid about people extracting the contents of your pagefile, then it's not really to your benefit to have it cleared at shutdown (especially since I discovered it was back to it's full size instantly after a reboot).

I believe that magazines have said things about pagefiles and large amounts of memory (the most obvious being that the pagefile will waste more space as the amount of memory you have increases), but the only time you save is the time it takes Windows to swap data from/to memory from the pagefile - marginal time if you don't have excessive amounts of memory, have the pagefile located near the physical start of the drive, and make sure the pagefile doesn't get fragmented (which does not imply having it on a separate partition at all).

Billy T
26-11-2003, 01:08 PM
My only beef with swapfiles is that they represent a helluva lot of redundant data to compress into my image files. I aim to get my OS & programs image down to a size that will burn to one CD.

One day when I have nothing else to do (insert brittle laugh here) I might restore my virgin OS images and reinstall all programs on another partition. That would make it easy to keep my images on a single CD.


Billy 8-{)

Just an afterthought, didn't somebody here put their swapfile on a ramdrive?

Graham L
26-11-2003, 01:17 PM
If you have the "Let Windows manage the swap file", I'm pretty sure it will happily create a new one if it's missing. (It will probably create one even if you use fixed size). I like the experimental approach, rather than theory. B-) Why don't you try? Boot to DOS. Remove the swapfile. Start Windows.

Anyway ... I don't imagine that you are using these Ghost images so often that it would be a major problem having to set up the swap file after a recovery from a crash. :D There's certainly no point in saving the swap file to a CD.

26-11-2003, 01:35 PM
Well some people might like to keep snapshots of the data in the swapfile so they can, in 30 years time, show their grandchildren what programs they were running and what data was in their computers memory... like a history of their computer :p :D

Graham L
26-11-2003, 01:43 PM
Except ... apart from the fact that the CDs probably won't be readable, :D, have you ever tried "reading" what's in a swap file? It's not a pretty sight.

26-11-2003, 02:13 PM
No, but the contents can pose risks to security, so I imagine there would be a way to assemble the gargle into data that makes sense.