Link to home
Start Free TrialLog in
Avatar of SAbboushi
SAbboushiFlag for United States of America

asked on

Easiest way to DELETE pagefile.sys & hiberfil.sys before create image

What is the easiest / fastest (and free!) way (under DOS or Windows) to delete pagefile and hibernation file from my NTFS system partition so that I can take a ghost image?

Notes:
1) I currently boot up BartPE (installed on a dos partition) and Shift/delete the files; then I boot into DOS and ghost the system partition
2) I use Ghost 2003 - it does not have the ability to exclude these files from an image taken of an NTFS partition
3) The soluton has to take less time than what I am already doing!

Fastest way I can think of is an ntfs driver that lets me delete files from DOS that allows me choose which partitions to access (e.g. I remember messing around with some ntfsdos drivers, but either they were read only and/or they assigned drive letters for ALL of my NTFS partitions and ran out of memory because I have almost 2 dozen partitions); a DOS solution would save me time because then I don't have to boot up BartPE.

With Regards-
Sam
Avatar of cgbent
cgbent
Flag of United States of America image

Why not just disable the Hibernation and Paging in the windows installation that you are going to Ghost, remembering that if these settings need to be configured on the machines when you transfer the image?

If you are using sysprep before you create the image you can put the following line under the [Unattend] section

KeepPageFile=0

This will delete your pagefile when run sysprep. I do not know if it deletes the hybernation file or if you can with another command.
Avatar of rindi
You could try using DSL or InsideSecurity, both very small Linux LiveCD's. At least one of them has writing support for ntfs, but I'm not sure which one or both. They load very fast.

http://www.inside-security.de/INSERT_en.html
http://damnsmalllinux.org/
Avatar of SAbboushi

ASKER

cgbent:>> Why not just disable the Hibernation and Paging in the windows installation that you are going to Ghost,
Last time I looked into that, I learned that (at least) the paging was not deleted.  Don't recall about hibernation file.  If there is a script that will do this and another one that will reconfig them after I reboot, then I would be interested in that solution!

chuck-williams: thanks - but not using sysprep

rindi: THanks - but as stated, need Dos or Windows solution.
Why DOS or Windows if you can also do it with something else?

You could of course try to start into the recovery console and then delete the files from there.

In windows you can disable hibernation and that will also remove the hibernation file. The pagefile you could make very small, like 64MB so that it doesn't make much difference. You would have to reboot first for the change to become active though.
>> Why DOS or Windows if you can also do it with something else?
This is not the only tool I need access to - all of my other utilities are under DOS or Windows

>> In windows you can disable hibernation and that will also remove the hibernation file. The pagefile you could make very small, like 64MB so that it doesn't make much difference. You would have to reboot first for the change to become active though.
More of a hassle and would probably take just as much time especially if no scripts to automate the process.

>> Recovery console: Hmmm... I am running Vista Ultimate - don't know how to access Command Console (think I might need an Anytime Upgrade CD?)  - If I can install command console to my DOS partition like I used to do with XP - AND - it would allow me to delete these file, then I would be VERY interested in this solution.
SAbboushi;

In regards to page file and hibernation files being deleted, the pagefile in some versions of windows will be deleted upon restarting the system with the page file disabled, if not you can delete it from the hidden root of C: by simply selecting and pressing delete. Same goes for the hibernation file which upon restarting with the settings disabled should get deleted by windows. Again if not delete them manually from the root of the c: drive with "hide protected operating system files" DISABLED

The names of the files are;

pagefile.sys & hiberfil.sys
The Linux LiveCD's I suggested would be an alternative to BartPE you've been using until now, but it is much faster to load. I still don't see anything that would require this to be DOS/Windows based.
cqbent - thanks, but this requires another boot into windows IN ADDITION TO changing the settings back and forth - so will take longer than my current solution...

rindi - I agree that if I ONLY needed to do this procedure upon bootup to Linux, then your solution would be great.  However, I have many tools and utilities in a DOS partition that I also need to use.
Thanks PLSM - seems this is saying that making the registry change will delete the pagefile upon shutdown and does not require me to sysprep (is that correct?)

However, that still leaves me with the hibernation file...
What I do is let Sysprep temporarily resize the pagefile to 10-20MB using the support pages I supplied. I.e. use method 1 from http://support.microsoft.com/kb/892104 and set the KeepPageFile option to "KeepPageFile=" (without the "") in Sysprep.inf.

As far as I know there is no way of removing the hiperfile. I did do some tests though, booting up in BartPE, then deleting the pagefile and hiperfile manually, then creating the image, and it actually, incredibly, resulted in larger image file sizes than when I just used the above.

I still need to finally confirm this, as it seems wrong as MS teels you that you can delete the pagefile after using the above, but that is what it looks like at this point. Maybe it's to do with the hiperfile... I will test more.
Ps. Why do you boot into DOS to build the image, when you are already booted into BartPE? Using BartPE allows you to use windows drivers rather than DOS drives, and that does speed up thing quite a lot.
PPS. Under normal circumstances you always need to sysprep.
ASKER CERTIFIED SOLUTION
Avatar of SAbboushi
SAbboushi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm glad it's solved. I've learned a few things too so all is good.

Ps. sysprep is used to remove SID's, drivers and generally put the machine into a preimaging state... as far as I know.
Oh... wanted to say, in BartPE you have to use Ghost32 rather than ghost.
>> Ps. sysprep is used to remove SID's, drivers and generally put the machine into a preimaging state... as far as I know.

I used to sysprep before imaging, but only in an ATTEMPT to protect me in case my computer was trashed and I needed to restore the image on a differently configured computer (although image requires a compatible HAL for restoration).  I concluded that restoring an image to the same machine or to an identical REPLACEMENT machine does not require a sysprep.

Ah... Sorry, I assumed you were a desktop engineer.
No worries!