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 > drive numbering inconsistent /dev/diskXs10 ?

drive numbering inconsistent /dev/diskXs10 ?
Thread Tools
Fresh-Faced Recruit
Join Date: Jan 2004
Location: Middlesex County, MA, US
Status: Offline
Reply With Quote
Jan 1, 2004, 09:04 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).

SCSI_Bus0:
•DriveA
•DriveB

SCSI_Bus1:
•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 had to add a line to my /etc/fstab file:

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

If the system decides randomly that it wants to switch B and C, then /dev/disk2s10 will point not to my swap, but to my users - and it will mount my users as the swap! Not only that, but it will recreate a new /Users folder! Then it mounts swap as "swap 1".

Now I have to fix everything, and I can do that, but I'm concerned that it will flip-flop again (randomly).

Any thoughts on how to deal with the situation?
     
TigerKR  (op)
Fresh-Faced Recruit
Join Date: Jan 2004
Location: Middlesex County, MA, US
Status: Offline
Reply With Quote
Jan 1, 2004, 10:36 AM
 
Ok, from Apple's Discussion Forum:
Originally posted by "Charles E. Flynn":
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. Therefore, editing the etc/fstab file is not the best way to relocate the swap partition.

See the posting by Trevor about editing /etc/rc from Tue Sep 10, 2002 9:24 pm_ at:

http://forums.osxfaq.com/viewtopic.php?t=2631

I have not tried this with Panther.

Contributing Editor, OSXFAQ.com
No wonder why moving /Applications and /Users using mount points and fstab never worked.
     
rkt
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jan 1, 2004, 04:08 PM
 
Originally posted by TigerKR:
No wonder why moving /Applications and /Users using mount points and fstab never worked.
This has changed with 10.3... fstab now supports the LABEL or UUID tag for identifying devices for the specification of mount points. see the fstab man page for more info.
     
TigerKR  (op)
Fresh-Faced Recruit
Join Date: Jan 2004
Location: Middlesex County, MA, US
Status: Offline
Reply With Quote
Jan 1, 2004, 04:19 PM
 
VM is started before autodiskmount is run. LABEL and UUID require autodiskmount to have been run.

So that won't work for swap, you need to use /dev/diskXsX. And that won't work, unless your swap partition is on your boot drive (which is always /dev/disk1sX) or if you have only two total SCSI or IDE drives.

I even tried using autodiskmount, and that didn't work either.

Code:
echo "Starting virtual memory" Consolemessage "Starting Virtual Memory" swapVOL="/Volumes/swap" swapDIRn="/.vm" swapDEF="/private/var/vm" swapOLD="/private/var/vm" ssLOG="/Library/Logs/CustomVM.log" echo "`date` - Starting Virtual Memory" >> "$ssLOG" Consolemessage "Begin autodiskmount..." echo "`date` - Begin autodiskmount" >> "$ssLOG" if [ -f /sbin/autodiskmount ]; then /sbin/autodiskmount else echo "ERROR: /sbin/autodiskmount is missing. Reverting to default swap..." echo "`date` - ERROR: /sbin/autodiskmount is missing. Reverting to default swap." >> "$ssLOG" ConsoleMessage "Cannot find /sbin/autodiskmount. Reverting to default, see /Library/Logs/CustomVM.log" swapVOL="${swapDEF}" swapDIRn="" fi if [ -f "${swapOLD}/swapfile0" ]; then rm -rf ${swapOLD}/swap* echo "Removing old swapfiles from ${swapOLD}" echo "`date` - Old swapfiles removed from ${swapOLD}" >> "$ssLOG" fi if [ ! -d "${swapVOL}" ]; then ConsoleMessage "Cannot find user specified swap volume. Reverting to default, see /Library/Logs/CustomVM.log" echo "`date` - ERROR: cannot find user specified Swap Volume '${swapVOL}' for CustomVM; volume or disk may have been removed or renamed; Reverting to default at ${swapDEF}." >> "$ssLOG" swapdir="${swapDEF}" ssERRORtxt="${swapdir}/swap_READ_ME_Virtual_Memory_ERROR.txt" else echo "Set swapdir to ${swapVOL}" swapdir="${swapVOL}${swapDIRn}" echo "`date` - Setting Virtual Memory path to ${swapdir}" >> "$ssLOG" fi if [ "${netboot}" = "1" ]; then sh /etc/rc.netboot setup_vm "${swapdir}" fi # Make sure the CustomVM swapfile directory exists if [ ! -d "${swapdir}" ]; then ConsoleMessage "Creating CustomVM swap directory" mount -uw / mkdir -p -m 755 "${swapdir}" chown root:wheel "${swapdir}" ssABOUTtxt="${swapdir}/About_This_Folder.txt" echo "`Date` - If the folder containing this file contains files called 'swapfile0', 'swapfile1', etc. DO NOT DELETE THIS FOLDER. If this folder only contains this file, you may delete the folder. To test if this is your active VM target folder, delete this file, Restart your computer; if this file reappears, this is the active VM directory." >> "$ssABOUTtxt" else rm -rf ${swapdir}/swap* fi if [ -f "${swapDEF}/swapfile0" ]; then echo "ERROR: see ${ssLOG}" echo "ERROR: Removing errant swapfiles from ${swapDEF}; last system session had incorrect VM path settings or desired VM disk was removed or renamed; check VM settings." >> "$ssLOG" rm -rf ${swapDEF}/swapfile* fi if [ ! -d "${swapVOL}" ]; then echo "`Date` - Your Virtual Memory settings are (or were) incorrect!; the designated volume ${swapVOL} cannot be found; it may have been removed or renamed; to confirm, delete this file, Restart computer, and check for this file again." >> "$ssERRORtxt" fi echo "Launch dynamic_pager at ${swapdir}" echo "`date` - Launch dynamic_pager at ${swapdir}" >> "$ssLOG" dynamic_pager -F ${swapdir}/swapfile Consolemessage "Virtual Memory by CustomVM successful"


And I get this:

cat /Library/Logs/CustomVM.log
Thu Jan 1 16:54:16 EST 2004 - Starting Virtual Memory
Thu Jan 1 16:54:16 EST 2004 - Begin autodiskmount
Thu Jan 1 16:54:17 EST 2004 - Old swapfiles removed from /private/var/vm
Thu Jan 1 16:54:17 EST 2004 - ERROR: cannot find user specified Swap Volume '/Volumes/swap' for CustomVM; volume or disk may have been removed or renamed; Reverting to default at /private/var/vm.
Thu Jan 1 16:54:17 EST 2004 - Launch dynamic_pager at /private/var/vm

and this:

cat /private/var/vm/swap_READ_ME_Virtual_Memory_ERROR.txt
Thu Jan 1 16:54:17 EST 2004 - Your Virtual Memory settings are (or were) incorrect!; the designated volume /Volumes/swap cannot be found; it may have been removed or renamed; to confirm, delete this file, Restart computer, and check for this file again.
     
rkt
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jan 1, 2004, 04:48 PM
 
Originally posted by TigerKR:
VM is started before autodiskmount is run. LABEL and UUID require autodiskmount to have been run.
didn't say anything about swap... just /Applications & /Users

*shrug*

however, if you're into splicing your startup files you could try this:

http://www.macosxhints.com/article.p...31104150206554
     
TigerKR  (op)
Fresh-Faced Recruit
Join Date: Jan 2004
Location: Middlesex County, MA, US
Status: Offline
Reply With Quote
Jan 1, 2004, 07:24 PM
 
I've been through the MacOSHints site. No luck.

And for the record, using fstab for /Applications and /Users didn't work (using the UUID and LABEL in the fstab file) either.

*Sigh* I was able to move my swap in Jaguar, why not now...
     
TigerKR  (op)
Fresh-Faced Recruit
Join Date: Jan 2004
Location: Middlesex County, MA, US
Status: Offline
Reply With Quote
Jan 1, 2004, 08:09 PM
 
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. The fix (which I found at <http://www.macosxhints.com/article.p...31103155828117> ) is, in the terminal to type:

sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true

Now its working (without altering the fstab file).
     
TigerKR  (op)
Fresh-Faced Recruit
Join Date: Jan 2004
Location: Middlesex County, MA, US
Status: Offline
Reply With Quote
Jan 1, 2004, 09:27 PM
 
So, with the help of some friends, 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>
     
rkt
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jan 2, 2004, 09:40 AM
 
Originally posted by rkt:
This has changed with 10.3... fstab now supports the LABEL or UUID tag for identifying devices for the specification of mount points. see the fstab man page for more info.
actually i got a chance to poke at my mail server (which uses custom mountpoints for logs &c.) and i see that this change happened circa 10.2, not 10.3...
     
rkt
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jan 2, 2004, 09:46 AM
 
Originally posted by TigerKR:
There's no need to alter the /etc/fstab file.
i would have thought it was still a good idea to use fstab to specify the mountpoint, not least as it avoids the swap volume being mounted in the finder...?
     
TigerKR  (op)
Fresh-Faced Recruit
Join Date: Jan 2004
Location: Middlesex County, MA, US
Status: Offline
Reply With Quote
Jan 2, 2004, 11:22 AM
 
Originally posted by rkt:
i would have thought it was still a good idea to use fstab to specify the mountpoint, not least as it avoids the swap volume being mounted in the finder...?
If you use the fstab file, and you specify the device, and you have more than 2 drives, and you're using a drive other than the boot drive for swap, then what you think you're specifying as swap, might not be swap, it might be another partition on another drive, which is bad.

As I said earlier, VM is started before autodiskmount is run. LABEL and UUID require autodiskmount to have been run.

Therefore, using fstab for swap, is bad.
     
rkt
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jan 2, 2004, 09:03 PM
 
Originally posted by TigerKR:
If you use the fstab file, and you specify the device, and you have more than 2 drives, and you're using a drive other than the boot drive for swap, then what you think you're specifying as swap, might not be swap, it might be another partition on another drive, which is bad.
*sigh* yes, i do understand this.

however, my point is slicing up your /etc/rc* seems "bad"; sitting in a loop testing for the existence of a .Trashes directory on the target volume is a kludge...

so i guess my question is, "is this the /really/ neatest way to do it?"
     
TigerKR  (op)
Fresh-Faced Recruit
Join Date: Jan 2004
Location: Middlesex County, MA, US
Status: Offline
Reply With Quote
Jan 4, 2004, 10:19 AM
 
Originally posted by rkt:
*sigh* yes, i do understand this.

however, my point is slicing up your /etc/rc* seems "bad"; sitting in a loop testing for the existence of a .Trashes directory on the target volume is a kludge...

so i guess my question is, "is this the /really/ neatest way to do it?"
Slicing up the rc file might be bad, but mounting one partition as if it was another one is much worse. Besides, this addition to the rc file would fail gracefully due to its thorough error checking, and not drop you into single user mode or worse.

And checking for the .Trashes is the quickest way to test that you've found the root of a partition, and that you're not deep in the higherarchy somehow.

Typically, with my system, it doesn't enter into the loop at all. That's just in case the drive takes its sweet time spinning up.

Can't write a StartupItem either, because VM loads before those do.
     
   
Thread Tools
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 -5. The time now is 10:44 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2