6

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

Update:

I use Windows 7 64-bit edition.

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

6 Answers 6

1

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.

3
  • The only way to get really better performance is to buy more RAM. And it is probably cheaper too.
    – Tonny
    Dec 21, 2014 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, 2014 at 16:35
  • @cybernard Thanks! That's really clever! Guess I'll stick to that and create another partition. Dec 21, 2014 at 19:01
6

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.

1
  • 2
    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, 2018 at 10:20
3

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.

5
  • I was till now convinced that the pagefile can't be fragmented. Dec 21, 2014 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, 2014 at 11:43
  • @Tetsujin off topic to my comment and the question, but does the pagefile get ever shrinked (except when its done manually)? Dec 21, 2014 at 12:16
  • 1
    if it's system managed, yes, as Windows sees fit.
    – Tetsujin
    Dec 21, 2014 at 12:32
  • 2
    PageDefrag cannot operate on NT 6.0 or newer. Additionally, it only runs under x86 editions of Windows. Aug 31, 2020 at 21:23
1

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

0
1

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.

1

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.

1
  • 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, 2018 at 11:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .