Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making swap space contiguous

Status
Not open for further replies.

xwb

Programmer
Jul 11, 2002
6,828
GB
I've installed XP on an oldish machine - won't take anything else: only 1GHz and 512Mb memory. Won't even take Ubuntu beyond 12.04. Anyway, by default, it creates a swap space of 750Mb. I normally increase this to 4096Mb. For some silly reason, even though the disk is completely blank, it splits the swap space in two.

Apart from reinstalling and creating a separate drive just for the swap space - I normally do this but I haven't installed XP for so long, I completely forgot, is there any way of making the swap space contiguous?.

 
I don't understand what you mean by "the disk is completely blank". Surely it has the windows files on it.

Ignoring that, and dredging my memory, what I would try is, switch off the use of a swap file and reboot. Then defrag the drive, possibly several times, until the free space is all in one contiguous chunk. Next turn on the use of a swap file with whatever size you want and reboot.

I seem to recall I have had luck using this method.

Good luck.
 
That was me typing without thinking how someone else would interpret it when they read it. Yes you are correct: it is blank except for the installed files. This is a more pictorial description of the problem. A disk fragmentation analysis shows something like

[pre]|/////XXXX ///// |[/pre]

Where the // is the blue/red bits and the XXX is the unmovable swap area. If I now fix the size of the swap to 4096, I get

[pre]|/////XXXX /////XXXXXXXXX |[/pre]

instead of

[pre]|/////XXXXXXXXXXXX ///// |[/pre]

so the swap is now in 2 separate areas of the disk which isn't very efficient. Even if I run a defragment, it will not merge them since they are unmovable areas. I will just get

[pre]|/////XXXX////// XXXXXX |[/pre]

OK, so what you are saying that I need to do is

1) Set the swap to 0
2) Reboot
3) Defrag until I get all blues and no reds or greens
4) Recreate the swap
5) Reboot
6) Check

I'll let you know what happens.
 
I don't know whether it will let you set the swap to zero size, but if it does I am not sure that it will have the same effect.

My intention was that you tell the system to not use a swap file. A subtle difference, but it could be significant.
 
NTFS stores it's backup MFT right in the middle of the disk, which limits the maximum contiguous size you could have to be half the disk.

One possible workaround would be
1. disable the swap
2. fill the disk to nearly half full with multiple copies of a small film (say 100GB).
3. defrag to make sure the space after the centre MFT is nicely unused.

You might have to fiddle around with steps 2 and 3 to get the first half of the disk nicely 'full'.

4. enable the swap with the size you want.
Hopefully, this will be created as a single extent after the centre MFT.

5. delete all the space filling files saved in step 2 [smile]

The downside is that it's now further away on disk than the rest of the regular use files.

Another approach might be
1. Disable swap.
2. Enable compression on all the non essential parts of the system.
3. Defrag.
4. Fill with junk to approx half full.
5. Disable compression on everything done in step 1. The effect should be to push a lot of things past the central MFT.
6. Delete all the junk from step 4.
7. Use Defrag to see how the free space is occupied.
8. Enable swap.



This might also help as well.
This seems to be one of the few sysinternals tools which still explicitly supports XP.
For example, says support starts at Vista, but claims to work on all versions of NTFS. It may be interesting for the curious [wink]



--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top