OS X Swap file

firewall

Registered
I have read on various posts that setting the swap file on a different partition speed up OS X a lot.

can anyone answer those questions for me

1- from a technical point of view why does it speed it up?

2- how big should the partition be?

3- I have 2 internal hard drives one with os 9.21 and the other with 10.1 , can i set the swap file on the 9.21 or should I partition either one of the drive to set a unique partition for the swap file?

4- how to set it up? ( idiot proof instructions, :D )

Thanks
 
Some info

The swap is much like virtual memory. It uses disk space to page in and out data that ram doesn't have room for and does this with some intelligence lower priority things are what will swap first allowing things with higher priorities to get more of the real ram.

NOTHING is better than a whole lot of real RAM. the best solution is to not need to use the swap at all...

if you plan to move your swap file the best location is a separate small drive or partition of a separate drive.

it should not be more than 500 meg anything larger and you are defeating the purpose of isolating it.

the reason you isolate it is when data is written to a drive it can fragment and cause the drive to thrash around looking to find this data. causing the drive to loose performance. the system and your users space will no doubted get a lot of data read and written to it this combined with the data being written to the swap can slow things down.

swap files are created in 80 meg file increments as needs get higher swap space increases in 80 megs increments.

the reason you would use a separate drive is so that the swap is not competing with the other data to be read and written. as you can see with one drive setups a partition helps limit the area it has to look for the swap data in but the drive head still has to jump all over to read and write... while this solution is fine better is 2 drives with the swap on a small partition on the secondary drive. this further helps because now the drive doesn't have to bounce around reading and writing. small partitions are easier for a drive to manage and are less prone to bad fragmentation. this is why the swap should not be more than 500 meg any more than this would waste space and defeat the goal in addition the swap partition should not be used to save files to it is just for the swap.

in the end what all this sums up to is... you won't see amazing speed changes that's not what this does. it helps things run more efficiently so the speed gains are more in that you don't sit watching beachballs and system performance doesn't degrade while running a lot of apps. again NOTHING BEATS REAL RAM!

more info can be read here as well as a step by step how to guide

My main system config -

G4 500
640 megs RAM
2 internal IDE Drives
drive 1
Capacity: 27 GB
X 8.49 GB
Users 8.49 GB
Backup 8.49 GB

drive 2
Size: 6 GB
2 partitions
swap 500 meg
Classic remaining
Volume format: Mac OS Extended (HFS+)
I put classic on this drives partition because I rarely use it so most of the time the drive is free to run as swap only.

as you can see from above
classic, OS X, Users, swap all have their own partitions.

I hope this helps a bit
cheers
 
You know, if you think about the geometry of a disk, it seems to me that it would make sense to put your swap partition on the first cylinders. Most people do not fill up even 25% of their disk, so the heads spend most of their time in that particular portion of the disk. Putting your swap on the outside cylinders means the arms have to sweep across the disk to access swap and then back to read data.

Thoughts?
 
it seems to me that it would make sense to put your swap partition on the first cylinders. Most people do not fill up even 25% of their disk, so the heads spend most of their time in that particular portion of the disk. Putting your swap on the outside cylinders means the arms have to sweep across the disk to access swap and then back to read data.

To a minor point I would have to agree to this... Though the speeds that drives run at these days it would be minor but it is still related as to why you would use a separate partition or drive.

I do want to mention that 10.1 has made amazing strives to cut down on the need for VM. only in extreme low ram situations does it dip into this and I am sure that it will get better and better yet to come.

also one other thing I fail to mention earlier... If you DO decide to move your swap you will need to redo the /etc/rc edits every time you upgrade your OS.
So if your not into tinkering this could be a reason not to bother. Further if your machine has 64 megs of ram to 128 megs of ram you will not be able to avoid using the swap and in machines like this no matter how or where you place the swap you will not see dramatic speed improvements. Just a little more to think about.

Cheers
 
I'm all for adding a cheap IDE multi-gig drive and setting aside a portion exclusively fo swap.

Can you refresh my memory on which partition is considered "inside" versus "outside" when looking at it through the Disk Utility? When you specify 2 or more partitions and looking at the "Untitled 1", "Untitled 2", etc., what is the correct order?

Cheers.

Originally posted by sinebubble
You know, if you think about the geometry of a disk, it seems to me that it would make sense to put your swap partition on the first cylinders. Most people do not fill up even 25% of their disk, so the heads spend most of their time in that particular portion of the disk. Putting your swap on the outside cylinders means the arms have to sweep across the disk to access swap and then back to read data.

Thoughts?
 
Well, I'm a Solaris eng., so I'm used to laying out my disks with a little more control. The Disk Utility doesn't give you fine control of your disks. I'm working on the assumption that the first partition will be closer to the inner part of the disk and more partitions will be in the outer.
 
Put the swap on the outside of the disk. This part of the disk spins faster than the inside, speeding up swapping :)

Does 10.1 have something similar to the format utility in Solaris where you can define partitions by cylinder?
 
Thanks for the reply.

However, I'm still a bit puzzled by the graph that Disk Utility uses to indicate partition size... which is inner or outer? I guess I could run it on the extra drive and do a kf -d(?) command to view the partitions and figure out which one is which.

I was just hoping legacy Mac users might remember...

Thanks.

Originally posted by Solaris
Put the swap on the outside of the disk. This part of the disk spins faster than the inside, speeding up swapping :)

Does 10.1 have something similar to the format utility in Solaris where you can define partitions by cylinder?
 
Back
Top