Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 21, 2013, 07:48:02 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: 3rd party software to move pagefile.sys and hiberfil.sys  (Read 6150 times)
Anders Lund
JkDefrag Supporter
***
Posts: 12


View Profile
« on: August 04, 2009, 11:17:30 pm »

I wonder if anyone knows a utility, that can move hiberfil.sys and pagefile.sys to other locations on the harddisk?

I know utilities like the one Sysinternals made, that can defrag these files. But I want to place pagefile.sys in the begining of the drive and hiberfil.sys in the last part of the drive.

Pagefile.sys is of cause to placed in the start to get extra speed and hiberfil.sys - it is only used if my laptop runs really low on battery. So I want to move these files. But not to much. I want pagefile.sys to be after MFT, directories and bootfiles, so the program have to have some kind of setting, to place the pagefile.sys the right place (like giving it a start sector, a percentage or a MB setting, so the program will know where to place the file. Hiberfil.sys should just go to the very end.

Any ideas?
Logged
gemisigo
JkDefrag Hero
*****
Posts: 110


View Profile
« Reply #1 on: August 04, 2009, 11:29:15 pm »

I don't think there are utilities for that. Afaik, MyDefrag is the only defragger that allows you to create zones and to allow some influence on where the files will be placed.

Neither do I think you should move those files to anywhere else they are created, but if you are eager to place them where you want them to be, you could achieve that with MyDefrag. All you have to do is to remove them (disable paging and hibernation), and create the script that would leave gaps big enough to store them in one piece.

You could even take the chance and create a file called pagefile.sys (I think you can do that with paging disabled, but I'm not sure) and create a zone where it should be with the gap after it big enough to hold it when it will be extended to its full size. The same applies to hiberfil.sys, although it tends to be placed towards the end of the disk on its own.

So, all you need is Bruce... Err, MyDefrag Wink
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #2 on: August 05, 2009, 12:41:17 am »

I wonder if anyone knows a utility, that can move hiberfil.sys and pagefile.sys to other locations on the harddisk?
Have you read the second paragraph on the How do I defragment "C:\pagefile.sys" (the swapfile)? page? Many people place too much importance on the pagefile. If your computer has plenty of memory then it's actually better to turn it completely off.

As far as I know it is impossible to move the hiberfil.sys file. For more information see How do I defragment "C:\hiberfil.sys"?
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #3 on: August 05, 2009, 12:44:09 am »

You could even take the chance and create a file called pagefile.sys (I think you can do that with paging disabled, but I'm not sure)
It's an interesting idea. I would love to hear if somebody has actually tried it, but I think it's a bit dangerous. See the MyFragmenter to create a file.
Logged
usch
JkDefrag Senior
****
Posts: 35


View Profile
« Reply #4 on: August 05, 2009, 02:27:09 am »

I know utilities like the one Sysinternals made, that can defrag these files. But I want to place pagefile.sys in the begining of the drive and hiberfil.sys in the last part of the drive.
Heh. I used MyDefrag today on my office PC that has never been defragmented since day one (in other words, for more than five years). I added a MakeGap call to the script to create a 4 GB free zone right after the system files. Afterwards I ran PageDefrag from Sysinternals. Guess what: It put the page file at the very end of the 70 GB disk and totally ignored the free zone I had created at the beginning.  Angry

XP is quite stubborn about its page file ... if you disable it, it gets deleted immediately, if you enable it, it is created and immediately gets locked. I'll play around with it a bit tomorrow.
Logged
Anders Lund
JkDefrag Supporter
***
Posts: 12


View Profile
« Reply #5 on: August 05, 2009, 07:59:16 am »

I don't think there are utilities for that. Afaik, MyDefrag is the only defragger that allows you to create zones and to allow some influence on where the files will be placed.

I think that I have seen at lest one defrag program, that allowed me to move the pagefile to the beginning of the drive. Im not sure, as I haven't dealt with many other (pay) defragprograms.

Quote
Neither do I think you should move those files to anywhere else they are created, but if you are eager to place them where you want them to be, you could achieve that with MyDefrag. All you have to do is to remove them (disable paging and hibernation), and create the script that would leave gaps big enough to store them in one piece.

Well, I would love to hear from others, that might have done this, before I do anything. I mean, if I could avoid moving all the data around om my disk to much (while testing and trying), that would be optimal.  Wink

Quote
You could even take the chance and create a file called pagefile.sys (I think you can do that with paging disabled, but I'm not sure) and create a zone where it should be with the gap after it big enough to hold it when it will be extended to its full size.

I thought about the same thing - but I just wanted it to be automated with a program. Smiley

Quote
The same applies to hiberfil.sys, although it tends to be placed towards the end of the disk on its own.

In my case, hiberfil.sys is located in the start of the drive and pagefile.sys 1/5 from the end.  Angry
Logged
Anders Lund
JkDefrag Supporter
***
Posts: 12


View Profile
« Reply #6 on: August 05, 2009, 08:17:28 am »

Have you read the second paragraph on the How do I defragment "C:\pagefile.sys" (the swapfile)? page? Many people place too much importance on the pagefile. If your computer has plenty of memory then it's actually better to turn it completely off.

I often run multiple virtual machines at once (at one time 7 Windows servers!) and that pushes the 4 GB of memory in my laptop. So the pagefile.sys get used from time to time and that is where I want it to be optimal.

Quote
As far as I know it is impossible to move the hiberfil.sys file. For more information see How do I defragment "C:\hiberfil.sys"?

As mentioned in the original post, Sysinternals has made a tool called PageDefrag, that can defrag hiberfil.sys. I have just tested it. It does it by doing defragmentation in early Windows startup.

Maybe, you could make an utility for MyDefrag, that allows it to run at this early stage, before to many files get locked, including pagefile.sys and hiberfil.sys? I really don't know anything about how "special" such a program had to be.
Logged
Anders Lund
JkDefrag Supporter
***
Posts: 12


View Profile
« Reply #7 on: August 05, 2009, 08:21:05 am »

You could even take the chance and create a file called pagefile.sys (I think you can do that with paging disabled, but I'm not sure)
It's an interesting idea. I would love to hear if somebody has actually tried it, but I think it's a bit dangerous. See the MyFragmenter to create a file.
I will try it, when I have some time to let my computer do some test defrag.
Logged
gemisigo
JkDefrag Hero
*****
Posts: 110


View Profile
« Reply #8 on: August 05, 2009, 08:26:55 am »

It's an interesting idea. I would love to hear if somebody has actually tried it, but I think it's a bit dangerous. See the MyFragmenter to create a file.
Actually I did try it, not on my system partition though, I'm not that brave Smiley I copied a virtual disk (just because of its size, it was 2GB) to one of my extended partitions, moved where I'd like it to be, and then turned on paging on that partition, and increased its size to 3GB. This way it could not fit in the gap existing there. It said there was already a file named pagefile.sys and asked if I want to overwrite it. I said yes, it was created and split in two, but remained where it was.
So, it works. Still, I think Jeroen is right, it might be dangerous and I would not try it on system partition without a good reason. I agree with him that many people think the placement of pagefile a way more important than it really is so it is not considered a good reason. Except, of course, when it is totally at the end. That's bad.
You should not move it to the front of the disk. This way it would displace many other (perhaps more) significant files, and the overall performance will be lower.

My suggestion is that if you are not as unlucky as usch was, you rather do not move pagefile. As for the hiberfil.sys, it is a really dangerous think to mess with. MyDefrag won't even let you defrag a hibernated disk, it would ruin the machine state.

In my case, hiberfil.sys is located in the start of the drive and pagefile.sys 1/5 from the end.  Angry
You can disable hibernation and paging altogether, then reenable paging first and hibernation after. This way the files should switch positions. Not necessarily will but they should Smiley

Quote
Maybe, you could make an utility for MyDefrag, that allows it to run at this early stage, before to many files get locked, including pagefile.sys and hiberfil.sys? I really don't know anything about how "special" such a program had to be.
Such an utility in not necessary. You can run MyDefrag from PE, boot CD, boot pendrive, whatever. Much more efficient than defragging at boot time.
Logged
Anders Lund
JkDefrag Supporter
***
Posts: 12


View Profile
« Reply #9 on: August 05, 2009, 08:47:40 am »

It's an interesting idea. I would love to hear if somebody has actually tried it, but I think it's a bit dangerous. See the MyFragmenter to create a file.
Actually I did try it, not on my system partition though, I'm not that brave Smiley I copied a virtual disk (just because of its size, it was 2GB) to one of my extended partitions, moved where I'd like it to be, and then turned on paging on that partition, and increased its size to 3GB. This way it could not fit in the gap existing there. It said there was already a file named pagefile.sys and asked if I want to overwrite it. I said yes, it was created and split in two, but remained where it was.

Sounds good. I will try something similar. Thank you for testing.

Quote
So, it works. Still, I think Jeroen is right, it might be dangerous and I would not try it on system partition without a good reason.

I think Windows is smart and won't break because of this - as long as I don't do it on a disk, that is in hibernation. Also, I have a good backup and frequently reinstall Windows (and soon again, with the Windows 7 RTM comming out). Cool

Quote
You should not move it to the front of the disk. This way it would displace many other (perhaps more) significant files, and the overall performance will be lower.

Good point. I would try to fit it in right after "normal files", but before my virtual machines and the rest of the drive.

Quote
In my case, hiberfil.sys is located in the start of the drive and pagefile.sys 1/5 from the end.  Angry
You can disable hibernation and paging altogether, then reenable paging first and hibernation after. This way the files should switch positions. Not necessarily will but they should Smiley

Sure, just like USCH wrote about in this thread.  Grin

Quote
Quote
Maybe, you could make an utility for MyDefrag, that allows it to run at this early stage, before to many files get locked, including pagefile.sys and hiberfil.sys? I really don't know anything about how "special" such a program had to be.
Such an utility in not necessary. You can run MyDefrag from PE, boot CD, boot pendrive, whatever. Much more efficient than defragging at boot time.

I am using BitLocker on my drive, so it wont be (easy) accessable, if booted on something else.
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #10 on: August 05, 2009, 08:56:28 am »

So, it works.
Thanks for testing and for the feedback, I appreciate it. Hmmm. I was thinking that it might be possible that when MyDefrag encountered the pagefile it would programmatically disable the pagefile, create a new file, and enable the pagefile again. But I am sure Windows will require a reboot to disable the pagefile. So I cannot use it as a trick to move the pagefile.

By the way, I remember somebody reporting that MyDefrag managed to move the pagefile on non-system disks when booted from a cdrom. I'm not sure which Windows version, I think it might have been WinPE based on Vista.
Logged
gemisigo
JkDefrag Hero
*****
Posts: 110


View Profile
« Reply #11 on: August 05, 2009, 09:45:42 am »

But I am sure Windows will require a reboot to disable the pagefile. So I cannot use it as a trick to move the pagefile.
Yes, it does. And no, you can't Sad

By the way, I remember somebody reporting that MyDefrag managed to move the pagefile on non-system disks when booted from a cdrom. I'm not sure which Windows version, I think it might have been WinPE based on Vista.
Imho, it is much more convenient and simple to remove the pagefile and create a gap to it. Rather that than to move a  couple GBs back and forth.
Logged
eejay
JkDefrag Supporter
***
Posts: 14


View Profile
« Reply #12 on: August 05, 2009, 11:50:44 am »

Has anyone suggested UltimateDefrag 2008?
It can move and defrag these files at boot time.
Check it out
Logged
eCo
JkDefrag Supporter
***
Posts: 13



View Profile
« Reply #13 on: August 05, 2009, 09:16:37 pm »

PageDefrag was leaving pagefile.sys in multiple fragments on my disk so I found another solution. I created a BartPE boot disk with a custom folder containing a copy of MyDefrag + the attached script. After the BartPE CD boot, I open a command line and type in :
Code:
cd \MyDefrag
MyDefrag -r SlowOptimizeC -d0

You will have to adapt my script to your case of course. It only defragments the C drive and puts pagefile.sys in the 3rd zone (ie after the system files and directories but before the boot files).

It works as a charm thanks to MyDefrag ! Wink

* SlowOptimizeC.MyD (3.68 KB - downloaded 235 times.)
« Last Edit: August 05, 2009, 09:22:49 pm by eCo » Logged
SchoolDaGeek
JkDefrag Supporter
***
Posts: 11


View Profile
« Reply #14 on: November 10, 2009, 07:34:09 am »

I just watched with glee as my pagefile was moved as well, thanks to your script and MyDefrag!
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!