jaquar and swap partitions

Discussion in 'Mac Apps and Mac App Store' started by mmcneil, Sep 24, 2002.

  1. mmcneil macrumors regular

    Joined:
    Sep 4, 2001
    Location:
    San Diego, CA
    #1
    Many of the methods previously posted no longer work with jaguar including some that I have previous posted. jaguar includes quite a few changes to the booting process and as a result the previous methods become extremely unreliable or interfere with the boot process. If you are interested in assigning a dedicated swap space under jaguar the following works:

    create a "swap" partition - best if is the first partition, optimal if it is on a separate drive from your primary drive. The swap partition should probably be at least 1GB since jaguar is much more VM intense than 10.1.5

    Reboot and ensure that your swap partition is mounted in /Volumes/Swap [this is case insensitive currently]. If you aren't sure how to do this, send me email.

    make a copy of the original /etc/rc in case you need to recover from this

    sudo cp /etc/rc /etc/rc.old

    edit /etc/rc and make the following changes between the first and last lines of this segment of the file i.e. the first and last lines of the segment remain the same. these changes should protect the system under most conditions including failure of the swap partition to mount.

    As always, there are risks involved and you should backup your data and make sure that you have a bootable CD or external HD to rescue you :D

    ##
    # Start the virtual memory system.
    ##

    ConsoleMessage "Starting virtual memory"
    #Set swapdir for a netboot situation only
    swapdir=/private/var/vm

    if [ "${netboot}" = "1" ]; then
    sh /etc/rc.netboot setup_vm ${swapdir}
    fi

    #
    ## Autodiskmount version of setting up swap, copied from
    ## /System/Library/StartupItems/Disks/Disks

    if [ ! -f /var/db/volinfo.database ]; then Uninitialized_VSDB=-YES-; fi

    ConsoleMessage "Checking disks"
    /sbin/autodiskmount -va

    if [ "${Uninitialized_VSDB:=-NO-}" = "-YES-" ]; then vsdbutil -i; fi

    ConsoleMessage "Setting up Swap"
    swapdir=/Volumes/Swap/.vm

    # Make sure the swapfile exists
    if [ ! -d ${swapdir} ]; then
    swapdir=/private/var/vm
    ConsoleMessage "Creating default swap directory"
    mount -uw /
    mkdir -p -m 755 ${swapdir}
    chown root:wheel ${swapdir}
    else
    rm -rf ${swapdir}/swap*
    fi

    dynamic_pager -H 40000000 -L 160000000 -S 80000000 -F ${swapdir}/swapfile
     
  2. Rower_CPU Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #2
    Here's the real question: What's the performance gain for doing all that?

    I could barely notice any speed improvements on 10.0-10.1...
     
  3. mmcneil thread starter macrumors regular

    Joined:
    Sep 4, 2001
    Location:
    San Diego, CA
    #3
    Performance Improvements

    Good question - Some early tests with 10 were significant 20%+ if you had a separate HD, and I saw similar improvements when I configured my Pbook BK with two drives. At this point I haven't tested for performance improvement and I'm not sure what a good test would be in my case since I am primarily using one drive. I will play around with some testing when my new TiBook arrives and see if there is anything to report;)
     
  4. sparkleytone macrumors 68020

    sparkleytone

    Joined:
    Oct 28, 2001
    Location:
    Greensboro, NC
    #4
    from what I understand the performance increase with 10.0.x was very significant, but since 10.1 it has been negligable.
     
  5. redAPPLE macrumors 68030

    redAPPLE

    Joined:
    May 7, 2002
    Location:
    2 Much Infinite Loops
    #5
    excuse my ignorance, but...

    what is a "swap partition"?

    as much as i understand, it would make jag faster...?
     
  6. mmcneil thread starter macrumors regular

    Joined:
    Sep 4, 2001
    Location:
    San Diego, CA
    #6
    Wisdom comes from asking

    Swap space is the Unix term for Virtual Memory - OS X has a particularly nifty (IMHO) approach to using VM. In older Unix systems, you had to assign a fixed space or file on a disk partition for use as swap - if you ran out -too bad. OS X assigns its space adhoc, when needed - very cool - only a problem when you run out of disk space

    Anyway, the real question is whether there is any performance gain to assign a dedicated swap partition under OS X. The concept is that a dedicated partition minimizes any "fragmentation" of the swap files and thus improves performance. It is complicated by many factors - how many swap files does it take to get fragmentation, etc. etc.

    I'm going to try and test this over the next couple of weeks - my 400M G3 with only 384M RAM has had as many as 18 swap files so perhaps I'll be able to find a combination that allows meaningful tests.:cool:
     
  7. redAPPLE macrumors 68030

    redAPPLE

    Joined:
    May 7, 2002
    Location:
    2 Much Infinite Loops
    #7
    that's interesting.

    does apple have an official comment on this issue?

    re: how many swap files does it take to get fragmentation...

    or if it has any advantages regarding speed etc.
     
  8. oldMac macrumors 6502a

    Joined:
    Oct 25, 2001
    #8
    Only significant with dedicated disk

    The only significant gain you could get by doing this would be to put the swap file on a fast, dedicated drive. Even better, put that drive on its own drive controller.

    Messing with it for a single drive (even if partitioned) probably isn't worth the hassle. It might make a difference if your disk is very full (90% or more).
     

Share This Page