Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Moving the swapdir in OS X 10.2.x
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="gatorparrots" data-source="post: 962"><p>Many techniques were developed for moving the swap directory in OS X 10.1.x and several applications were even written for that expressed purposes. None of those techniques or applications work very cleanly in OS X 10.2.x (resulting in <em>.vm 1</em> or duplicate mounts and other oddities); but that's okay, because moving the swap file in Jaguar is easier than it has ever been. [No fstabs, no StartupItems, etc.]. This technique merely requires the editing of a single system file to make the configuration change.</p><p></p><p>The first step is to back up your <strong>/etc/rc</strong>, as we will be editing it and want to preserve a backup copy to fallback on in case things go awry:</p><p><span style="color: blue">sudo cp -p /etc/rc /etc/rc.default</span></p><p></p><p>Here is the relevant latter half of <strong>/etc/rc</strong>, which is all that needs to be edited to move the swap location in Jaguar:</p><p></p><p>You might think that changing <strong>swapdir=/private/var/vm</strong> is all you need to do, but of course Apple didn't make it that easy on us! Not only do you have to change the location of the swapdir by changing the argument, but you also have to move the relevant VM section to the end, just before the <strong>exit 0</strong>, in order to allow for the pre-heat and other essential sections to run first; also we'll add a <strong>mount -a</strong> command for an extra margin of safety, just before establishing the swap location (in the example below, the swap directory is moved to a separate partition, <strong>/Volumes/.vm</strong>:</p><p></p><p><em>(If you're very daring, you can try out different pager settings, but I don't necessarily recommend it, unless you are trying to squeeze every drop of performance out of a server machine or something. Apple has given us good general defaults in this regard. Change them at your own risk.)</em></p><p></p><p>Upon the next reboot, first confirm that the volume has mounted successfully with <strong>df</strong>:</p><p>And then run an <span style="color: blue">ls /Volumes/.vm</span> for good measure to confirm the swapfiles are being written to that partition:</p><p>If everything looks good, you should be able to <span style="color: blue">sudo rm -f /private/var/vm/swap*</span> to clear the old swap files.</p></blockquote><p></p>
[QUOTE="gatorparrots, post: 962"] Many techniques were developed for moving the swap directory in OS X 10.1.x and several applications were even written for that expressed purposes. None of those techniques or applications work very cleanly in OS X 10.2.x (resulting in [i].vm 1[/i] or duplicate mounts and other oddities); but that's okay, because moving the swap file in Jaguar is easier than it has ever been. [No fstabs, no StartupItems, etc.]. This technique merely requires the editing of a single system file to make the configuration change. The first step is to back up your [b]/etc/rc[/b], as we will be editing it and want to preserve a backup copy to fallback on in case things go awry: [color=blue]sudo cp -p /etc/rc /etc/rc.default[/color] Here is the relevant latter half of [b]/etc/rc[/b], which is all that needs to be edited to move the swap location in Jaguar: You might think that changing [b]swapdir=/private/var/vm[/b] is all you need to do, but of course Apple didn't make it that easy on us! Not only do you have to change the location of the swapdir by changing the argument, but you also have to move the relevant VM section to the end, just before the [b]exit 0[/b], in order to allow for the pre-heat and other essential sections to run first; also we'll add a [b]mount -a[/b] command for an extra margin of safety, just before establishing the swap location (in the example below, the swap directory is moved to a separate partition, [b]/Volumes/.vm[/b]: [i](If you're very daring, you can try out different pager settings, but I don't necessarily recommend it, unless you are trying to squeeze every drop of performance out of a server machine or something. Apple has given us good general defaults in this regard. Change them at your own risk.)[/i] Upon the next reboot, first confirm that the volume has mounted successfully with [b]df[/b]: And then run an [color=blue]ls /Volumes/.vm[/color] for good measure to confirm the swapfiles are being written to that partition: If everything looks good, you should be able to [color=blue]sudo rm -f /private/var/vm/swap*[/color] to clear the old swap files. [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Moving the swapdir in OS X 10.2.x
Top