Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have 3 physical drives in my Mac Pro with Mac OS X 10.6.4. Occasionally after rebooting the machine, the disk numbering changes such that the /dev/disk# does not reference the same drive as it did before the reboot.

Example

/dev/disk0 -> 64GB SSD drive
/dev/disk1 -> 640GB Hitachi
/dev/disk2 -> 160GB WD (BootCamp)

After rebooting the mapping might be

/dev/disk0 -> 160GB WD (BootCamp)
/dev/disk1 -> 640GB Hitachi
/dev/disk2 -> 64GB SSD drive

Even more confusing is that the remapping is not consistent. For most stuff this is irrelevant. However I also have Parallels installed to allow access to the BootCamp partition from within OS X. Parallels uses the /dev/disk# path in it's configuration file so, after rebooting OS X I launch Parallels and it tells me that the disk is no longer present.

Is there a way to tell OS X to always assign a given drive to /dev/disk0?

share|improve this question
3  
This is not within the realm of my expertise, but can something be done with volume UUIDs? –  fideli Sep 18 '10 at 1:08
    
@fideli: Don't know...that's what I need the help with :) I had expected that OSX did just that - remembered where a drive with a given UUID was mounted and left it there but that doesn't seem to be the case. –  Paul Alexander Sep 21 '10 at 2:27
    
In Linux the disks have symlinks like /dev/disk/by-uuid/[disk-uuid] that doesn't change even if the numbering does. Maybe OSX is similar? –  solarc Oct 1 '10 at 5:44

6 Answers 6

To see the pathnames of the character device files for the volumes on your internal hard disk, open the Terminal application, located in /Applications/Utilities. Type the following, followed by the Return key:

df

You can see the complete pathnames for the character device files for current volumes by opening Terminal, then typing (press Return after each line):

cd /dev
ls -lias

Each partition (whether it displays in the Finder or not) on each mounted volume will have two files in the list for the /dev directory. The names of the files identify both the device by number and the partition on the device by its number. You may have to scroll a bit in the Terminal window to find the files.

share|improve this answer

As far as i understand MacOS doesn't have that capability, although for running parallels it might not be strictly necessary.

using macports and installing e2fsprogs with a small patch:

diff -r e2fsprogs-1.41.12/misc/Makefile e2fsprogs-1.41.12.patched/misc/Makefile
399c399
>       $(LIBEXT2FS) $(LIBCOM_ERR)
---
<       $(LIBEXT2FS)
401,402c401

you can use blkid -s UUID /dev/rdisk* to enumerate partitions, disks and get their respective uuids (for any supported file-system which is quite a few).

After that a adding a softlink with 'ln -s' or creating an alternate device node with mknod should work (and then reference that psudo-/clone-device from Parallels). I've done similar tricks with Fusion, but I haven't got Paralells installed right now (so I can't test)

stat -f "%Sr %Z" /dev/rdisk*s* gives you a map over device to major,minor to be used if parallels doesn't accept a soft-link to the device.

which can be used as in the following example:

some@host:/e2fsprogs-1.41.12$ blkid -s UUID /dev/rdisk*s* 
/dev/rdisk0s1: UUID="76D6-1701" 
/dev/rdisk0s2: UUID="654F73AE51849687" 
/dev/rdisk1s1: UUID="51FC4E72-BFA9-4DBD-9A5C-0E5H731DB0ED" 
some@host:/e2fsprogs-1.41.12$ stat -f "%Sr %Z" /dev/rdisk*
rdisk0 14,0
rdisk0s1 14,1
rdisk0s2 14,2
rdisk1 14,3
rdisk1s1 14,4

# okay, UUID 51FC4E72-BFA9-4DBD-9A5C-0E5H731DB0ED is a partition
# on the disk we want to use. so we make a 'private' device node
# pointing to the device containing that partition.

some@host:/e2fsprogs-1.41.12$ sudo mknod /dev/pdisk1 b 14 3

# just a quick verify that the mknod worked as expected ...
some@host:/~$ sudo dd if=/dev/rdisk1  count=10 2>/dev/null | md5 
19d55b28485771bc80acdddbd1b45faf
some@host:/~$ sudo dd if=/dev/pdisk1  count=10 2>/dev/null | md5 
19d55b28485771bc80acdddbd1b45faf

Now the only thing left is to write a script and using the instructions in http://support.apple.com/kb/HT2420?viewlocale=en_US to make it run at boot.

But that will be for somebody else to finish ...

share|improve this answer

Try to add entries into you /etc/fstab.

An /etc/fstab example:

# Identifier, mount point, fs type, options1
UUID=DF000C7E-AE0C-3B15-B730-DFD2EF15CB91 /export ufs ro
UUID=FAB060E9-79F7-33FF-BE85-E1D3ABD3EDEA none hfs rw,noauto
LABEL=This40Is40The40Volume40Name none msdos ro

The Identifier is used to identify the volume; the LABEL is the volume name, the UUID is the Universal Unique Identifier Drive. You can use both, but the UUID is the best choice because renaming the volume will not change this identifier.

From http://macosx.com/forums/mac-os-x-system-mac-software/314314-stop-disk-unmounting-automounting.html

share|improve this answer
    
This only changes where the drive is mounted in the /Volumes directory. It doesn't have any affect on it's /dev/disk??? assignment. –  Paul Alexander Sep 21 '10 at 21:28

I've heard smarter Mac guys than me imply that the disk numbering is somewhat arbitrary and one can not depend on the same device getting the same number after a reboot. It was mentioned in reference to creating RAID slices via diskutil in the Terminal.

None of the low level utilities I've found, such as diskutil, pdisk or gpt, appear to be able to affect the disk numbering. I'm afraid it may not be controllable.

share|improve this answer
    
Huh, I didn't think the answer was -1 bad. Sometime the answer is "you can't do that." –  Theo Belk Oct 7 '10 at 13:34

The drive number is based on when the physical device is enumerated during boot. This has happened to me as well on Windows. I have looked long and hard for a resolution to this, and I have not found one. I was able to get the disks in the "correct" order when I switched the SATA cables around, but this was only a temporary fix. In your case, since Parallels relies on the disk numbering for a path, it may be best to create a script to update that config file on startup.

share|improve this answer

I've had this issue before, they usually change after I've done updates or installed something, but return to their original numbering after a second restart. This is obviously not ideal, but seemed to work for me...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.