Any suggestions how can I make pagefile.sys contiguous and move it to the beginning of the disk? Much appreciated.


I use Windows 7 64-bit edition.

  • What version of Windows? – Dude named Ben Dec 21 '14 at 11:15
  • @DudenamedBen 64-bit Windows 7 – user2543574 Dec 21 '14 at 11:38
  • 1
    btw, the word you are looking for is contiguous, rather than continuous. – Tetsujin Dec 21 '14 at 11:48
  • Welcome. . . ;) – Tetsujin Dec 21 '14 at 15:06

If you want your swap file to truly be at the front of the drive use partitioning software, like gparted, to shrink your C: drive and create a partition, d: for example, and place the swap file there. If you are doing this to get better peformance you are better off getting a second, smaller hard drive or ssd, and dedicating it to only the swap file.

  • The only way to get really better performance is to buy more RAM. And it is probably cheaper too. – Tonny Dec 21 '14 at 16:32
  • @Tonny I guess I should have qualified that, the question only asks about the swap file. The only way to get better performance from your swap file. Better performance globally is new CPU,8+gb RAM, motherboard, SSD and etc – cybernard Dec 21 '14 at 16:35
  • @cybernard Thanks! That's really clever! Guess I'll stick to that and create another partition. – user2543574 Dec 21 '14 at 19:01

A simple solution (which won't move the pagefile to the beginning of the disk) is to disable virtual memory, then reboot and finally re-enable pagefile (this time with a fixed size).

This method will ensure your new pagefile is in one "chunk" on your disk and will also prevent any future fragmentation of the pagefile.

  • Unfortunately, Windows likes to pick up every tiny free space hole. When I do this I get 70000 fragments for a 16GB file. NTFS has horrible allocation algorithms. – usr Dec 11 '18 at 10:20

Moving it to the beginning of the disk is relatively pointless nowadays, but for defragmenting it you can use PageDefrag. Note that fragmented files are not an issue on SSDs.

  • I was till now convinced that the pagefile can't be fragmented. – marsh-wiggle Dec 21 '14 at 11:42
  • 1
    it can quite easily frag if it's set to system managed size. It shrinks, a file is placed next to it, it grows - fragged. – Tetsujin Dec 21 '14 at 11:43
  • @Tetsujin off topic to my comment and the question, but does the pagefile get ever shrinked (except when its done manually)? – marsh-wiggle Dec 21 '14 at 12:16
  • 1
    if it's system managed, yes, as Windows sees fit. – Tetsujin Dec 21 '14 at 12:32

There is a useful piece of software from Iobit called 'smart defrag' that will de-fragment files such as the page file for you on boot through 'Boot Time Disk Defrag'.

Smart Defrag


Smart Defrag come with a lot of additional software. Bloatware. I would recommend Defraggler. It's small and fast and also has boot time defrag option. It display drive map and visualize what's being done (read, write) as it go with defragmentation (normal not boot time). At boot time it give you a textual output. Defraggler is free but has paid version with commercial support if you'd like. I use free one as it just is all I need.


First remove the pagefile entirely. Then defrag your C:-drive with Puran Defrag or similar software. And finally set the pagefile to a fixed size, the recommended size + 2 MB. Use the same size for the minimum and te maximum size, so the pagefile will not defragment anymore.

  • Welcome to Super User. For readers unfamiliar with the procedures, can you expand your answer a little to describe how to remove the pagefile, and how to enable it and set the size? Thanks. BTW, just noticed that this pretty much duplicates Kristian's answer. The intention is that each answer provide a substantially different solution than what has already been contributed. So adding some instructions (that were also lacking in Kristian's), would differentiate this answer. – fixer1234 Dec 2 '18 at 11:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.