By default, Mac OS X uses a swap file (for virtual memory) which is installed on the same drive as your operating system. For best performance, the swap file would ideally be located on the fastest drive in your machine, which may or may not be the same disk as your OS. Unfortunately, there's no built-in GUI for changing a swap drive location.
A few days ago, there was a help request on swapping on another hard drive and subsequent comments that figured out how this could be done. I asked if patpro, one of the users involved, would mind writing a step-by-step instruction set on how to transfer swap. Read the rest of this article to see what he had to say ... well worth the time if you have a spare, fast hard drive in your system!
patpro writes: "Well, I'd be glad to help you with that, but in fact, Sven had a lot to do with my success as well:)). He pointed out some important aspects of the boot process (mount especially)."
With that said, here are patpro and Sven's instructions on relocating your swap file.
NOTE: This hint now reflects the additional functionality submitted by John in the comments
cp /etc/rc .
df
/dev/disk0s9 3134688 1970568 1164120 62% /appsThere will be one line for each volume in your system.
su root
cd /etc/
pico rc
swapdir=/private/var/vmwith this
# Make sure the swapfile exists
if [ ! -d ${swapdir} ]; then
ConsoleMessage "Creating default swap directory"
mount -uw /
mkdir -p -m 755 ${swapdir}
chown root:wheel ${swapdir}
else
rm -rf ${swapdir}/swap*
fi
swapdir=/disk-name/path_to_swap_directoryBE CAREFUL: If your preferred disk is NOT hfs you MUST provide the mount command with it's correct file format (mount -t ufs, for example). So the 'mount' line must follow this framework:
# Make sure the swapfile exists,
# first check existence
# if not first make sure disk is mounted
if [ ! -d ${swapdir} ]; then
ConsoleMessage "mounting directories"
mount -t hfs /dev/disk**** /disk-name
mount -uw /
fi
# Make sure the swapfile exists,
# if not, create directory since disk should be mounted
if [ ! -d ${swapdir} ]; then
ConsoleMessage "Creating default swap directory"
mkdir -p -m 755 ${swapdir}
chown root:wheel ${swapdir}
else
rm -rf ${swapdir}/swap*
fi
mount -t (disk file format) /dev/(disk-reference) /(disk-name)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20001215021440138