Windows 7 and page file
I’ve noticed when uploading a windows 7 image the pagefile does not get removed like it does with XP… is there any reason why as we’re trying to keep the image as small as possible!
I’d suggest adding in the following lines right after “ntfs-3g -o force,rw $part /ntfs”:
[CODE]printf “Error Message: $?\n”;
Or use echo instead of printf. Just to see if there’s anything useful in there.
Tried finding the exit codes online, but it looks like the fastest way to find them would be to pull up the ntfs-3g man page from the console to see what the exit codes are (here’s the reference page which suggests doing that):
I’m in the same boat as with bash experience - anybody got any ideas how to debug this?
Interesting… $? checks for an error thrown by the previous statement, right? (I don’t have a ton of experience in bash). Maybe the mount succeeds, but technically has an error? $? could have useful information that could be printed. Hopefully, haha.
actually scrap that, because it mounts the device… it’s this if statement that seems to be the culprit…
if [ “$?” = “0” ]; then
nothing has been modified to affect this as far as i can see however when uploading windows 7 it does not even echo “removing page file” etc like the settings would suggest… so for some reason it’s not detecting $ignorepg is set to 1 but only for win7/8!?!, may remove the if statement and test this. will come back to you…
[FONT=Ubuntu][COLOR=#333333]FOG_UPLOADIGNOREPAGEHIBER is set to 1 and this is the code in init.gz fog script.[/COLOR][/FONT]
if [ “$ignorepg” = “1” ]; then
#if [ “$osid” != “5” ]; then
echo -n " * Mounting device…";
mkdir /ntfs &>/dev/null
ntfs-3g -o force,rw $part /ntfs
if [ “$?” = “0” ]; then
echo -n " * Removing page file…";
rm -f “/ntfs/pagefile.sys”;
echo -n " * Removing hibernate file…";
rm -f “/ntfs/hiberfil.sys”
Lee, can you check your settings and your fog script in init.gz to make sure something didn’t get changed?
There is logic to remove the hibernation and page files:
FOG_UPLOADIGNOREPAGEHIBER is a constant defined in config.php
createUploadImagePackage from functions.include.php makes use of this constant to determine how to set $ignorepg
$ignorepg is used by init.gz/bin/fog at about line 746 (search for $ignorepg, I have edited this file a couple times. not sure what line exactly it will be for you)
If $ignorepg has been set to 1 by createUploadImagePackage, then the drive should be mounted with ntfs-3g, and pagefile.sys and hiberfil.sys should be removed by rm -f
I thought there was code in 0.32 to remove the pagefile and hiberfil from the machine. If someone can confirm the code is in place but not working, we can create a bug report.
thanks for the info but i was hoping to keep it enabled but remove it from the image and let windows regenerate it after it imaged. if not will do this for hibernation but will still need to tackle the pagefile.sys
[B][COLOR=#333333][FONT=Verdana]Disable Hibernate (and Delete hiberfil.sys) in Windows 7 or Vista[/FONT][/COLOR][/B]
[COLOR=#333333][FONT=Verdana]You’ll need to open an administrator mode command prompt Once you’re there and type in the following command:[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]powercfg -h off[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]You should immediately notice that the Hibernate option is gone from the Shut down menu.[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]You’ll also notice that the [/FONT][/COLOR][B][COLOR=#333333][FONT=Verdana]hiberfil.sys[/FONT][/COLOR][/B][COLOR=#333333][FONT=Verdana] file is gone.[/FONT][/COLOR]
doesn’t seem to be - using generalize and unattend
Never really checked it but I thought windows 7 sysprep removes them.
…just to add to this it also doesn’t delete the hibernation file either C:\pagefile.sys & C:\hiberfil.sys are adding 8GB to the image size! i’m assuming it’s to do with the multi partitions - what would be the best way to manually delete these before uploading to fog? maybe utilising fog debug? any help would be muchly appreciated!