gravatar

Dedicate swap partition for Leopard

Prior to 10.5, it needs to modify /etc/rc.local to mount the disk partition because that dynamic pager is run before mounting volumes.
In Mac OS X 10.5 Leopard, /etc/rc.local does not no longer exist. Instead, lanuchd is used to run some daemons after system start. In /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist, it controls the dynamic swap size and location. In my case, I have a separated partition name ".swap" and will be mounted under /Volumes/.swap. Just run Terminal.app and sudo vi com.apple.dynamic_pager.plist to edit it. Here is a portion of an example,

<key>Label</key> <string>com.apple.dynamic_pager</string> <key>ProgramArguments</key> <array> <string>/sbin/dynamic_pager</string> <string>-S</string> <string>1073741824</string> <string>-H</string> <string>4096</string> <string>-L</string> <string>1073750016</string> <string>-F</string> <string>/Volumes/.swap/swapfile</string> </array> <key>OnDemand</key>
After reboot, the swapfile will be relocated to /Volumes/.swap and size is fixed to 1GiB. note: remember to delete /var/vm/swapfile* to release unused swap spaces.