View Full Version : Increase OS X Performance: Swap Partition

Sep 10, 2001, 08:38 AM
As most OS X users are probably aware "virtual memory" (or paging, in OS X's case) is always "on," as is the case with any modern operating system. It is an integral part of the kernel's functionality. As a result, every time OS X is booted a swapfile is written to the partition where OS X resides. When many apps are open and free physical RAM becomes scarce, more swapfiles (80MB each) are written to the disk at need. As far as OS's go, OS X has a particularly robust paging system--but it does suffer a speed hit due to OS X's default configuration of writing the swapfiles amidst the files on OS X's partitions. Inevitable file fragmentation forces the swapfile to be written to and read from all over the disk, imposing the seek-time limitations of the disk on OS X's attempt to swiftly page data to and from the disk.
The solution: create a dedicated swap partition (this is the way Linux's swap system is setup by defualt) for OS X to page to (on a separate physical drive, if possible). In searching the web for information dealing with this alteration, I found a number of sites with prodcedures to follow. The one I felt most comfortable using as a guide was setup by Andy Moraitis (mailto:andymoraitis@mac.com). In looking at his procedure and through back-and-forth e-mail with Andy, it's clear he has a deep understanding of the mechanisms of OS X and its paging system (and that of its predecessor, NEXTSTEP). And lucky for those with a mind to increase OS X's performance, Andy has recently put out an even more detailed version of his procedure, which you can get from his iDisk (http://homepage.mac.com/WebObjects/FileSharing.woa/wa/default?user=andymoraitis&fpath=OSX%20Hacks&templatefn=FileSharing.html). (Note this guide is in Tex-Edit Plus format--download this editor (http://www.versiontracker.com/moreinfo.fcgi?id=9013&db=mac) from VersionTracker.)
Truly, if you're even remotely comfortable with using the the OS X Terminal shell, this modification is time well spent.

Sep 10, 2001, 10:22 AM
i did this about 2 months ago and it wasn't that hard to do at all... and this is coming from someone who has true Terminal.app phobia!

try it... and as the walk thru i used said 'if you mess it up all that will happen is that it wont work, and your current swapfile will continue to be used'

there you have it... a small speed boost noticed, but nothing revolutionary... i suspect that 10.1 might hold more answers to your hopes as far as far a speed is concerned, but it cant hurt to try! and who knows, you might learn something - i certainly did!

Sep 10, 2001, 10:26 AM
Well, may be what I'm gonna say show my ignorance in the matter... but, I work with audio in my computer and audio soft does not work with virtual memory on. The problem with audio is that is a continuos piece of data that can not be interrupted at any time when playin from the hard drive.

In the OS X word, how this issue would be resolved if virtual memory is always on? I asume the file managment (to give it a name) would be different but how?

Sep 10, 2001, 10:59 AM
That's audio software for the Mac, under Mac OS 8/9, etc. Every modern operating system (MacOS 9 is not a moden operating system from a technical perspective) has virtual memory as a standard part of its operation---without the option of turning it off. The fact that under MacOS 8/9 you can turn off VM is a testament to how terribly it is implemented. The reason your audio software is complaining about VM is that under MacOS 8/9 it is slow and kludgy.

Unix has always had VM, and all of its flavors (Linux, NeXTSTEP, Solaris, QNX, Irix, etc.). With with Windows NT 3.1 (and soon after Windows 95) MS has had VM standard. It cannot be turned off in any of these configs, yet people get work accomplished in the pro audio sector. The answer to how to reduce problems associated w/ VM slowing your system is to add loads of physical RAM. Another is to get a fast SCSI drive system that has a VM partition on a separate drive from your main OS. That's where this article is headed--toward improving throughput by reducing the hit of memory paging.

Mac OS 8/9 has gotten people to thinking about VM as if it were an optional thing. That is a bad thing. A good thing is a machine with a decent amount of RAM and a fast and efficient VM system. And that's what we have with OS X. Thank heavens it's finally here, and OS 8/9 will soon be no more.


Sep 10, 2001, 12:30 PM
i agree with blakespot... the sooner OS 8/9 is out of the window and forgotten the better. from a technical point of view audio apps run in OSX run better not to mention a hell of allot more stable... just wait for Logic 5 coming out in the next few months! i cant wait... then all we'll need is a carbonised version of Peak and we'll be away!

Sep 10, 2001, 02:50 PM
I second--those virtual memory comments are absolutely true, and I only hope that longtime Mac users will start to catch on. I wanted to add that, according to a study published recently (I don't have the link, unfortunately), X actually has the lowest audio-app latency of ANY standard OS--including MS offerings and Linux. That, of course, is a Very Good Thing.

Sep 10, 2001, 04:19 PM
Audio on X is going to kick arse. Especially as any app running Core Audio/Core MIDI services ought to be able to shoot audio and MIDI to any other app using those services. So I will FINALLY be able to use Peak and Logic side by side, which will, well, be the ultimate. :)

I also heard that Classic in 10.1 WILL support audio hardware -- if this is true I am going to shoot a load, to put it bluntly. I sure hope so -- I never want to have to boot into 9 again.

Sep 10, 2001, 04:49 PM
A correction to blakespots's reply. Virtural memory in windows can be disabled but it its not recomended.

Sep 10, 2001, 05:32 PM
Howdy All!

Please note that I have posted a new version of the article to my iDisk in pdf format that no longer requires Tex-Edit Plus. The Tex-Edit files have also been removed since many people don't use the application in the first place.

Also, the FAQ was updated with three new questions.

Comments and feedback are welcome.


P.S. Any application (including audio programs) will automatically take into account that OSX uses a VM system and will operate within that framework. I don't know how complex this is in terms of kernel tasking and threading, but I'm sure that developers will have it figured out.

Sep 10, 2001, 09:29 PM
I can't get either of the pdf files on his idisk to open up. All I get is a 100 byte file. Do these files work for any of you?

Sep 10, 2001, 11:07 PM
Why so much negative feedback on this thread, people?

I don't understand.


Sep 11, 2001, 12:06 AM
If you ask me (which you didn't), that "positive/negative ratings" system is bunk. Trash it, the ratings never reflect the articles at all in any logical kind of way.

Sep 11, 2001, 01:32 AM
its a good way for people who don't have enough to say on the subject to be heard, and while i gave this one a positive vote, i can see why people would give it a negative...

if you try to look at it from the user point of view... allot of people (most infact) use macs for one reason only... superior design..... ease of use etc... and when it is pointed out by people in the know like Andy Moraitis that OSX was produced with what is effectively a design problem - something that could have been done better like the swapfile placement (especially when it is said to hinder speed!) - they see it as a problem with OSX and not some cunning walkthu devised by Andy...

if you see what i mean...

Sick of PDF's
Sep 11, 2001, 01:41 AM
Is it a crime now to post plain text files that ANYONE can download and read? None of thse PDF files will download correctly. They are both over 500k yet when I go to download them in any browser all I get is 100k of useless file.

Here's a tip, there's something in your /Applications folder called "TextEdit". Use that to make files that other OS X users can read.

Sick of PDF's
Sep 11, 2001, 01:44 AM
Also, why didn't the guy just throw up a webpage with the info? Why make people download something just to read? If we wanted to keep it all we would have to do is choose "save" in our web browsers.

Mr. Obvious
Sep 11, 2001, 01:57 AM
Dear Moron Administrators,

Perhaps there are so many negative votes for this story because people can't download the ****ING file. Thank you for your time.

Obviously yours,
Mr. Obvious

Sep 11, 2001, 04:22 AM
For some reason, either the files are corrupt or there is a problem with Apple's servers. I've been attempting to re-post them in original Tex-Edit Plus format and Stuffit 6.0 format and all attempts to do this have failed when I download them.

I'll probably end up taking the day off to work on the problem and will find some type of solution. While the latest document is the best, the original swap hack guide can be found at http://www.resexcellence.com under the MacOSX Mods Section. While it lacks the polish of my latest document in terms of explaining how and why swapfile partitions work, it will more than suffice for those of you who simply want to do the hack.

Please be a little patient. I'm working on this and hope to have it fixed sometime today.



Sep 11, 2001, 05:21 AM
Thanks to everyone for being patient with the swapfile PDF corruption problems. I tracked it down to errors caused by the pasted screenshots. As a result, the new file has been formatted in TexEdit and the screenshots have been replaced with Terminal text dumps.

While this isn't as visually striking as the original file, I'd rather you all had something useable instead of something you couldn't work with. I have reposted this to my iDisk and download tested it and works perfectly.

I'll also upload a PDF version from Preview sometime later today.

If you'll excuse me I'm late for an appointment with some 450 lb. deadlifts.

Thanks again for your patience,


password is pong
Sep 12, 2001, 04:46 AM
surely there aren't that many clueless dumbasses that visit this site.

Sep 13, 2001, 03:30 AM
I'd just like to point out that Andy is doing this from kindness and goodness of his own heart.

If there is one thing I am sick of seeing it's people who seem to think that the world owes them a debt because they are using MacOS X. I have particularly seen this attitude underlying conversations on running GNU GPL software on OS X, but it applies to this thread just as much.

I thank everyone who makes information on any technical tweak freely available, and suggest that if people have a problem with formats, etc. they mirror the content themselves, of course giving credit where credit's due.

If people like Andy are discouraged then most of us will never find out about tweaks like this, and we'll all have to suffer thinly veiled attempts to sell CDs (*cough* macgimp.com *cough*) because the good projects have dried up (anyone interested in running X windows or GIMP on OS X please look to fink.sourceforge.net).

Anyhow, I've gone offtopic with this little flamebait...


On an unrelated topic, doesn't it seem the default face is frowning? Maybe that's why there are so many negative topics! (Glass half empty guys... SMILE!)

Sep 13, 2001, 04:40 AM
Thanks Angus,

My thoughts exactly. I love breaking ass on something for months only to have people bitch that it's not set up on a web page. If someone can't download a 44k rtf file, then I would rather they didn't do the hack in the first place.

I'm busy enough as a full-time industrial engineer and part time personal trainer/nutritional consultant. if someone else wants to make this into a web page, then that's fine but somewhere in and between trying to do a service to the OSX community, I'd like to have a life.

Nuff said.


steve humann
Sep 14, 2001, 01:27 PM
My first time to this site and i mistakenly thought that clicking the "negative" link would take me to a page that would have all the unfavorable comments about this swapfile hack . I was curious to know why others seemed to think this was such a bad idea. After realizing my mistake i went back and clicked a positive vote to even things out. I guess i should go click another positive vote because i'm glad the article is there even if i end up not being able to make the hack work for me.

Sep 14, 2001, 04:00 PM

If you do have problems, e-mail me for technical help to get through it. No one who's sought my assistance has left without a working swapfile partition.


Sep 14, 2001, 05:08 PM
Is this the kind of procedure I should do after I install OS 10.1? I'm wondering what whether or not the upgrade to 10.1 will recognize the changes, etc... Or if I should just hold off until I upgrade to 10.1.


Sep 14, 2001, 06:29 PM
I mention in the FAQ, that it's not known whether the changes are overwritten by installing 5G55. At worst, you'll only have to redo the terminal work, so I see no point in not doing it. Once you have upgraded to 10.1, make sure that the fstab and rc files point to your swap partition, If not, su to root and re-do the hack. If you've done it once, doing it a second time is easy enough.

Hope that helps,


Sep 14, 2001, 10:58 PM
A PDF version of the swapfile hack compressed with Stuffit 6.01 has also been posted and tested for download integrity. The original RTF file has also been maintained.

Sep 15, 2001, 10:13 AM
Not really relevant to the issue at hand.... But and interesting old tidbit. I recall, when setting up VM on my 486-66 PC that I got to run NEXTSTEP v3.2 for Intel processors ( http://www.blakespot.com/list/images/eCesys1.jpg ), there was a way you could speed up VM accesses. The system I had used an ISA-based SCSI controller, tied to a 700MB Quantum HD (with a big ole' 512K cache--that was an EXPENSIVE drive back then, it sits in my Amiga 2000 presently, 7 yo drive). The VM system in NEXTSTEP allowed you, if you desired, to turn on compression (a simple 2:1 compression) via modifying a config file such as the ones we're dealing with here. As it turns out, it was faster to move 1/2 the amount of data from the drive, through that 8MHz ISA slot, into main memory and have the 486 decompress it before the OS made us of the paged data, than to move the full, uncompressed swap pages to and fro. I remember being surprised at the time--but a 486-66 was a pretty fast chip, back then.

I had to take out a loan, back in the day (3/94) to purchase that system which was strucutred specifically to run NEXTSTEP--it had 16MB of RAM (LOTS of RAM!), 700MB HD, 256K L2 cache, 17" altima screen, all black in color--$4,500.

Ahhh, the memories.


Sep 15, 2001, 05:32 PM
Take it somewhere else. Andy is doing this on his own time, just to help out the many, many Mac users who are not familiar with anything related to Unix and the new OS. I, for one, appreciate his efforts.

Likewise, I'm sure the administrators are doing their best. Making things like this OS X tip available can be a tremendous help. Last time I checked, this was not a pay site, so lose the harsh attitude.

Lars 20
Sep 18, 2001, 10:57 AM
Originally posted by blakespot
Every modern operating system (MacOS 9 is not a moden operating system from a technical perspective) has virtual memory as a standard part of its operation---without the option of turning it off. ...

Unix has always had VM, and all of its flavors (Linux, NeXTSTEP, Solaris, QNX, Irix, etc.).


So I assume that you take Linux as a modern OS, with VM and without the option to turn it off.

The statement about not being able to turn off swap is just plain wrong. Of course you _can_ disable VM, at least in Linux and Solaris.


Sep 25, 2001, 06:54 AM
Your comments on VM and OSX are worrying me. I have a G4 733 with 1152 Mo RAM under OS9.2 and one of the reason why I have not installed OSX (beside I can't see what to use it for as all my DTP and animation application would require classic anyway) is that in the memory control pannel I get a message: virtual memory can't operate with that amount of RAM (or something of that kind). What will happen under OSX will I have to remove RAM to get VM on or what?

Sep 25, 2001, 07:54 AM

With 1152 Meg of RAM in OS9, you have no reason to turn virtual memory on in the first place. I'm not sure you're getting memory errors (maybe not enough room on the drive to create an 1153Meg vm file?) in OS9, but as far as OSX is concerned, the kernel can address the maximum that the machine can hold (1.5 Gig).

Also, VM in OSX is always on and cannot be disabled as it's functions are part of the Unix subsystem. So you could load OSX and never have a memory problem. Also, turn off VM in OS9, since it's but a waste of drive space and it's not going to make anything faster.

Hope that helps,


Sep 25, 2001, 09:08 AM
In OS9.2 indeed I don't want to use VM (Adobe Premiere and and Finalcut pro...). What I meant was that the choice was not available anyway in memory control pannel. So what will happen when I will use classic (OS9.2) vithout VM over OSX with VM?

Sep 25, 2001, 09:25 AM
Classic is not actually another operating system, but an application under OSX. Since you'll be running in OSX, VM functions are on and that's all you really need to worry about. Just because OSX uses VM by default, it doesn't mean that when using Classic that OS9 needs it on as well. Remember, OSX controls Classic and not OS9.

If you do decide to install OSX, I recommend that you create separate partitions for OS9 and OSX. That way you can dual-boot the system by holding down the option key at startup (which will give you a menu of bootable partitions after it scans for devices).

My advice is that if you need heavy duty graphics apps, go ahead and install both systems, keep your main work in OS9 and boot into OSX to see mess around until your apps go native or are Carbonized to work in both. Classic is OK, but if you really want to get the job done, use OS9.

Hope that helps,