Virtual Memory to another HD?

Discussion in 'Mac Pro' started by suprajoe, Apr 4, 2008.

  1. suprajoe macrumors member

    Joined:
    Feb 1, 2008
    #1
    I thought I read awhile back someone posted on how to move the virtual memory to another hard drive. Now, I could be wrong, so I did a search and couldn't find the thread. So my question is on my mac pro, I have three HDs. 350GB that has OS. 500GB that is free. 1TB that has data. Is there a way to move the paging file (VM) so that it is being used on the 500GB hd? Thanks!!!
     
  2. GotPro macrumors 6502

    Joined:
    Jan 29, 2007
    #2
    Yes.

    It's a bit involved. You need to KNOW what you are doing in the terminal as root to do this:

    First you need to modify LaunchD and edit the com.apple.dynamic_pager.plist as follows:

    ========================com.apple.dynamic_pager=======
    "<key>Label</key>
    <string>com.apple.dynamic_pager</string>
    <key>ProgramArguments</key>
    <array>
    <string>/sbin/dynamic_pager</string>
    <string>-F</string>
    <string>"THIS IS WHERE YOU WILL PUT YOUR NEW STRING FOR WHATEVER VOLUME YOU WANT THE VM ON ala /Volumes/SwapDaemon"</string>
    </array>
    <key>OnDemand</key>
    <false/>"

    I personally have a 132 Gig partition called SwapDaemon mounted and working properly.

    When you run the command "ps -wax | grep dynamic_pager -m1"

    You should get the following returned:

    "38 ?? 0:00.01 /sbin/dynamic_pager -F "Whatever you named in the Dynamic Pager... mine is /Volumes/SwapDaemon"

    Next...

    Delete any swap files (rm -r) from /var/vm and set/repair the correct users/groups/permissions before rebooting to make sure everything is good.

    Reboot. Now... look in activity monitor... it should show a VM size of greater than zero.

    Now it should be working and you're good to go.

    Hope that helps.
     
  3. rob finch macrumors member

    Joined:
    Mar 24, 2006
    Location:
    England
    #3
    Nice guide GotPro, thanks.

    Is there much benefit to doing this? If so, what gains in performance could I expect to see?
     
  4. GotPro macrumors 6502

    Joined:
    Jan 29, 2007
    #4
    No problem.

    Yes, it makes a noticeable difference under specific circumstances:

    If you are reading from / writing to your boot drive and OS X starts paging at the same time. Obviously, being able to swap pages on a separate physical drive will eliminate the performance hit of the above scenario (as an FYI Windows allows you to do this through the GUI natively... Apple REALLY should have that option as well IMHO.)

    THAT SAID: This upgrade / modification comes with some caveats.

    #1) It is not for the casual GUI-only-minded user. If you aren't comfortable with / know how to get around in terminal as root user and know what and how to set permissions, users, groups, and don't feel comfortable rooting around the innards of your system: DO NOT DO THIS. If you accidentally screw something up even without meaning to (for instance, if you edit the above file with the wrong text editor you can screw up the permissions PERMANENTLY and Launchd will go into endless loop mode trying to mount the swap partition and keep failing to do so... rendering you with a very unhappy Mac)... you'll need to have the technical proficiency to figure out and fix whatever it is you might have broken. Unless you are ok with wiping clean and starting over if you screw up :D

    #2) I really REALLY recommend using vi as the text editor... under NO CIRCUMSTANCES should you edit the file with a GUI editor as you will end up with a @ in the permissions which you can't strip out... this is a known issue with this "modification".

    #3) Please make backups of all files before attempting to modify them. If I had to tell you to do #3, please don't attempt this modification!

    #4) DO NOT BOTHER setting up a separate partition on the SAME PHYSICAL DRIVE THAT OS X IS INSTALLED ON!!!! You MUST USE a completely DIFFERENT physical drive to see ANY benefit from this modification at all.

    #5) OS X doesn't entirely like this modification. Every now and then, even when it's set up and working... OS X will go into overload mode and freak out about the partition. A group of us are still investigating why this happens. After a few hours (it's happened 2 times in a month to me) it does it's thing and is happy again... basically... OS X at a system level ends up adding a NEW swap partition in the df table of the same name that you created, yet with a numerical appendage to the filesystem... for instance... right now... instead of "SwapDaemon"... OS X has created a new partition table called "SwapDaemon 0" and then about a day later DELETED the original "SwapDaemon"... although my mounted name on the Desktop is still the original "SwapDaemon". This is a work-in-progress modification... and does work beautifully in its current state for 99% of the time. However... obviously some other things are going on... so... just know what you are getting into before you go down this path!

    And with that... I leave you all to your madness!

    ;) Cheers!
     
  5. rob finch macrumors member

    Joined:
    Mar 24, 2006
    Location:
    England
    #5
    Thanks for another detailed explanation. I think I will take your advice and leave it alone. I'm happy to dabble with Terminal and have used similar vi on Linux before to edit config files, but would not know how to manage permissions or rescue the situation if anything went wrong.

    Thanks again!
     
  6. GotPro macrumors 6502

    Joined:
    Jan 29, 2007
    #6
    No problem. Yeah... the systems run very smooth even without this... one day someone will come up with a graphical way to do this that will be safe, hopefully incorporating it into ONYX or COCKTAIL or some such.

    In the mean time... enjoy your Mac Pro!
     

Share This Page