display | more...

Mac OS X has some hefty memory requirements, which even Mac Evangelists will admit makes it cumbersome to use properly. It needs a lot of RAM, and memory management (out of the box) swaps on a file on the hard drive that is easily fragmented. Thus, one option in getting the most out of Mac OS X, is to set up a dedicated swap partition, to enforce De-fragmentation. To do this You will need to repartition everything, so you may want to back up.

First you will want a swap partition of whatever size you like. Just remember that in Mac OS X that you will not be able to access this swap. 500 MB is a good number, I think. You can use Disk Utility or Drive Setup to do this, or you can use pdisk at command line. You may need to go back and use Disk Utility later on to format the swap to HFS+ properly.

Next, you will want to create the file /etc/fstab. On regular UNIX systems, this houses the mounting instructions to the operating system for boot-time and when calling mount. Most of this is now managed by NetInfo behind the scenes, but the old rules still apply. Type df -k or pdisk (in interactive mode) to determine the device in which your swap partition lives. It should be the size you allocated to it. Use vi or pico to edit (and create) the file, and make it look like this:

/dev/disk0s7 /Volumes/.swap hfs rw 1 2

Change this so that /dev/disk0s7 is the partition you chose to be the swap. The next step is to setup /etc/rc . This is an rc file that will be run upon start-up of the machine. Use a text editor to make it look like this:

# swapdir=/private/var/vm
swapdir=/Volumes/.swap/vm

You will want a trailing carriage return at the bottom of the file. The next step is to reboot and see if all is well. At the prompt, type the following:

bash-2.05$ cd /Volumes/.swap/vm
bash-2.05$ ls

swapfile0

If all is well you should see "swapfile0". The you can go on your merry Unixing ways with some dearly needed increased speed. If the file says "swapfile1" then you may have messed up your /etc/fstab Go back and try df -k again and make sure you have the right disk information. Then begin partying - things will only get better from here!


<--------------------------------------------------->

All information taken from http://www.ResExcellence.com/hack_html_01/06-01-01.shtml .

Log in or register to write something here or to contact authors.