Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > How to put swap on a different drive in Panther

How to put swap on a different drive in Panther
Thread Tools
Fresh-Faced Recruit
Join Date: Jan 2004
Location: Middlesex County, MA, US
Status: Offline
Reply With Quote
Jan 2, 2004, 12:12 AM
 
I have a DP1.25 MDD tower.

It has a 2 bus SCSI card. Attached to the first SCSI bus are two drives. Attached to the second SCSI bus is one drive. There are no other SCSI drives in the tower, and there are no IDE drives in the tower (just two ATA optical drives - but that's irrelevant).

SCSI0:
•DriveA
•DriveB

SCSI1:
•DriveC

Here's the problem. When I first installed Panther, when I typed df in the terminal, the drives were ordered as such:

/dev/disk1s10 DriveA
/dev/disk2s10 DriveB
/dev/disk3s10 DriveC

Now, after a few days, they're ordered differently:

/dev/disk1s10 DriveA
/dev/disk2s10 DriveC
/dev/disk3s10 DriveB

This is a problem, because DriveB has my swap, and DriveC has my Users (properly set in netinfo).

In order to use DriveB for my swap, I thought that I had to add a line to my /etc/fstab file:

/dev/disk2s10 /Volumes/swap hfs rw 1 2

When the system decided (randomly) that it wanted to switch B and C, then /dev/disk2s10 pointed not to my swap, but to my users - and it mounted my users as the swap! Not only that, but it recreated a new /Users folder! Then it mounted swap as "swap 1".

I had to fix everything, and I was concerned that it would flip-flop again (randomly).

And in fact, from this discussion <http://forums.osxfaq.com/viewtopic.p...0d8db6e3#10759> :

>Using fstab for moving the swap is a bad idea.
>You have absolutely no assurance that what was
>/dev/disk1s2 (for example) one day will still
>be /dev/disk1s2 the next time you boot.

In other words, from this discussion <http://discussions.info.apple.com/We....0@.599ea35e/0> :

>Character device description files (such as
>/dev/rdisk0s10) are created at boot time and
>do not survive a shutdown. Unless the boot
>volume is a CD, disk0 should contain the boot
>volume, but all other numbers cannot be assumed
>to remain stable.

A lot of people suggested that I use LABEL or UUID in /etc/fstab . But that wouldn't work because autodiskmount is supposedly loaded after VM.

Anyway, I think that I found the answer to the problem. Apparently, Panther doesn't mount non-IDE drives until the user logs in (and then unmounts them when the user logs out). This not only has implications for swap, but also being able to ssh into a computer where there is no user logged in.

You're going to need to have a swap partition formatted and ready to go, then edit /etc/rc with sudo. Here's the code to stick into your /etc/rc file. After it says "swapdir=/private/var/vm" paste this:

Code:
#------------------------------------- below inserted locally newswap=/Volumes/swap oldswapdir=${swapdir} if [ ! -d ${newswap}/.Trashes ]; then swapcount=1 ConsoleMessage "Waiting for ${newswap} to mount" while [ "$swapcount" -le 30 ]; do sleep 1 if [ -d ${newswap}/.Trashes ]; then ConsoleMessage "${newswap} mounted after $swapcount seconds" break fi swapcount=`expr $swapcount + 1` done fi if [ -d ${newswap}/.Trashes ]; then swapdir=${newswap}/.vm ConsoleMessage "Using ${newswap} for swapfile" if [ -f ${oldswapdir}/swapfile0 ]; then rm -rf ${oldswapdir}/swap* echo "Removing old swapfiles from ${oldswapdir}" fi else ConsoleMessage "Unable to use ${newswap} for swapfile" fi #------------------------------------- above inserted locally
And then if you're using non-IDE drives for swap, in the terminal, type:

Code:
sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true
There's no need to alter the /etc/fstab file.

References:

<http://www.sciencequest.org/support/...wapswapvm.html>

<http://www.macosxhints.com/article.p...31104150206554>

<http://www.math.columbia.edu/~bayer/OSX/swapfile.html>

<http://discussions.info.apple.com/We...aH.2@.599ea35e>

<http://www.macosxhints.com/article.p...31103155828117>
     
   
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -4. The time now is 06:41 AM.
All contents of these forums © 1995-2014 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2014, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2