Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Swap partition size' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Swap partition size
Authored by: Pedro Estarque on Aug 09, '04 03:07:37PM

The swap partition size depends on the amount of RAM you have installed, and the OSX version you use. 10.3 is much more swap hungry. Until 10.2 swap files were created in 80 MB each. They must have a new algorithm now as swap files are created like this:
swapfile0 64 MB
swapfile1 64 MB
swapfile2 128 MB
swapfile3 256 MB
swapfile4 512 MB

But they never exceed twice the amount of RAM you have.
For example: I have 768 MB of RAM, so I will never have a swapfile5 as it would be 1GB in size and the total would be 2 GB, more then 1536 which is the double.
I don't think UFS would be better then HFS+ cause if you only use the partition for swap, there is no fragmentation at all, as file sizes and order of creation are always the same.



[ Reply to This | # ]
Swap partition size
Authored by: folkert on Aug 09, '04 03:19:15PM
swapfile0 64 MB
swapfile1 64 MB
swapfile2 128 MB
swapfile3 256 MB
swapfile4 512 MB
see my post in the other thread, this kind of pattern will use only 64+64+128+256 == 512MB on a one gig swap partition since the 512MB chunk will likely require just a little too much space. -folkert.

---
$ hexdump /mach_kernel|head -1
0000000 feed face 0000 0012 0000 0000 0000 0002


[ Reply to This | # ]

Swap partition size
Authored by: RiotNrrrd on Aug 10, '04 03:58:10AM
$ hexdump /mach_kernel|head -1
0000000 feed face 0000 0012 0000 0000 0000 0002
"hexdump -n 4 /mach_kernel" is much cleaner. :)

As for the main thread, use Swap_Relocator: here

Ignore all the n00b comments that claim it doesn't work in 10.3.x. It does.

[ Reply to This | # ]
Swap partition size
Authored by: jalbrecht2000 on Aug 09, '04 04:14:17PM

The reason I opted for UFS over HFS+ was overhead. There is no need for a journaling file system on your swap partition. Journaling your swap file system will only hinder a systems performance. If the system were to crash there is no reason to have the swap journaled for recovery.

This coupled with the lack of fragmentation on UFS and a little research swayed me to use UFS instead. However either way will work.

---
__________
Justin



[ Reply to This | # ]
Swap partition size
Authored by: Anonymous on Aug 11, '04 08:53:44AM

You can turn HFS journalling off, which I do. And the comment about fragmentation not being a problem on a swap partition is still relevant. If you're smart and put nothing else on that partition, it essentially gets cleaned out each time you reboot.

Further, 1 GB swap is foolishly, dangerously low for a MacOS X install. I have 1 GB of installed RAM, and I -regularly- get over 2GB of swapfiles dropped on my disk. My personal "high-water" mark for my usage is 4 GB of swap files, and so I made my partition 6 GB. It is always safer to be a little generous, since MacOS X behaves very poorly when it starts running out of swap space. In the days of 10.1, you could panic your machine. Panther seems to be a bit more tolerant, but odd errors will occur.



[ Reply to This | # ]
Swap partition size
Authored by: lerici on Jun 24, '07 07:42:19PM

I agree with Justin's statement.

UFS IS going to be SAFER for any partition where there are a lot of dynamic changes ... such as spool swap and tmp. Just for the reasons he gave.

In order to achieve "higher performance" hfs+ apparently gives up a great deal of stability. As as has been shown in some of the recent algorithms tomes the larger the tree the less it matters whether it is "organized" a certain way or not. In point of fact the more random it is "layered" the better. So as partitions grow in size becoming huge it may be that the performance gains achieved with hfs will become less and less.

Bottom line: Random good, complex trees may be bad.



[ Reply to This | # ]
Swap partition size
Authored by: timcrawf on Aug 09, '04 04:34:38PM

Are you ure this is a Rule? I have an original 12" alBook with ony 640 MB of RAM and I typically get (this is not from my system right now, as I rebooted this morning and it has not gone this high yet)
swapfile0 64 MB
swapfile1 64 MB
swapfile2 128 MB
swapfile3 256 MB
swapfile4 512 MB
swapfile5 512 MB

for a total of 1.5 GB
This can occur in 3 day, or it might take 10, but if I don't reboot for some reason or another, It wil get this big



[ Reply to This | # ]
Swap partition size
Authored by: jalbrecht2000 on Aug 09, '04 05:25:07PM

There are a ton of debates on how big a swap partition should be. The overwhelming majority in the BSD community (and one that I've always used on my servers) is to make the swap twice the size of available RAM. Your mileage may vary....

---
__________
Justin



[ Reply to This | # ]
Swap partition size
Authored by: VernerEgon on Aug 10, '04 01:17:43PM
Pedro Estarque wrote:
swapfile0 64 MB
swapfile1 64 MB
swapfile2 128 MB
swapfile3 256 MB
swapfile4 512 MB

But they never exceed twice the amount of RAM you have. For example: I have 768 MB of RAM, so I will never have a swapfile5 as it would be 1GB in size and the total would be 2 GB, more then 1536 which is the double.

I am afraid that this is nonsense. I have often had more than twice the size swapfiles than my RAM - and I even have a GB in my PB, and I cannot understand why it should not exceed that when your open applications need more memory than what you have.
I even think that limiting a swap space to less than 3-5 GB, no matter what size your physical RAM is at, will lead you into trouble sometime.
Having had an iBook with about 1-1.5 GB left on the harddisk and 320 MB RAM, it often occured to me that there was no more space on the harddisk because of swapfiles. Had I only had 640 MB on a separate swap partition, my iBook would have crashed constantly.
My advice is not to trust old *nix-rules of the thumb. Hell, even on my AIX at work, we upped the VM to 20 GB at one time even though we only had 8 GB of physical memory back then. But using Smitty that is of course no big deal...

OSX is quite a different animal than what old BSD- and *nix-folks here seem to be used to. It certainly does not stop at twice the size of RAM.



[ Reply to This | # ]
Swap partition size only 2X - wrong!
Authored by: zahadum on Feb 26, '06 05:41:18AM

not true at all!

take a look at activity monitor!

tiger (and i am almost certainabout panther too) will easily chomp through 4GB or 5GB of VM under heavy loads (snowG3 640MB).

making definitive statements like this - that are just plain wrong - do a diservice to less experienced readers.

---
mailto:osxinfo _at_ yahoo.ca



[ Reply to This | # ]