How does OSX assign disk numbers?
I have four drives inside my Mac Pro.
- Bay 1:
/dev/disk1s3
- Bay 2:
/dev/disk0s2
- Bay 3:
/dev/disk2s2
(also, my boot drive) - Bay 4:
/dev/disk3s2
and/dev/disk3s3
How are the disk numbers assigned? If I swap Bay 2 and Bay 1, will the disks in those drives swap disk numbers (so I have /dev/disk1s2
in Bay 1, and /dev/disk0s3
in Bay 2)? Also, does it make any difference that the boot drive is in Bay 3 and/or that it isn't /dev/disk0s2
?
Solution 1:
Drive numbers are assigned by the OS on a first come, first serve basis. The numbering scheme is as follows (with a capital N being a number):
diskN - always refers to a primary drive (i.e. the entire drive)
diskNs1 - always EFI
diskNs2 - First actual volume on the drive
diskNs3 - Second volume on drive, if there is one...this can go on for as many volumes as you have.
You can get some of the information about drives and volumes with the GUI version of diskutil by opening diskutil, clicking on the drive or volume, and then right-clicking on the item and then selecting "Information" from the dialog.
Another way is to open up a terminal window and type "diskutil list" and it will provide you with a list of all the drives, their partitions sizes and names (don't type it with quotes, though). If you want specific info about a drive or volume type "diskutil info " for example:
diskutil info disk0
OR diskutil info disk0s3
The utility will provide detailed information about each. I personally find using the Terminal.app a little easier because I can pipe the output to a file if I need to instead of cutting and pasting and it shows the relations of the volumes to the partitions a bit more clearly (IMHO).
I wouldn't think that swapping the drives around in the bays would make any difference. On my development systems I can swap around firewire drives, take one offline, take the other offline, bring the first back up, and even though they get different drive IDs, if one is set as bootable it will remain bootable. Mac's use UUIDs to tag the drives which remain unique to the drive regardless of their disk assignment.
The firmware for a Mac Pro might allow a user to provision specific bays to be bootable.
Solution 2:
I would think so. I work on hard drives a lot on Mac systems, and with regard to at least external drives, the order they come up in never seems to matter based on where they're daisy chained in the system. In the world of removable drives, I think the UUID is the more important number. I would see no logical reason why OS X would attempt to apply something different for internal drives. Keep in mind that a lot of random events, such as temperature monitoring and adjustment of system are occurring at boot up, and these may interfere with the time each drive is probed and assigned an identity.
I would think that for the most part, at least under generally average conditions, a boot sequence would be at least somewhat repeatable, but I've also seen drive ID's change periodically...and yet they continue to boot in the right order. If Apple was smart, and I think they are, they target the UUID not a drive designation such as /dev/rdisk0s3. In this day and age, particularly with systems that can be configured to boot off of an external drive by default even though an internal drive is present it has to be the UUID that's telling the system where to boot from.
If you've ever had a system that was defaulted to boot off an external drive and then remove it, the OS typically, at boot time, flashes a question mark and then "hunts" for another hard drive. If it finds one, it boots, if it doesn't, you either get a flashing question mark OR the prohibited sign.
An excellent source for information, albeit probably too technical for most system user is SCSC's book on hard drive troubleshooting. You can go to this site, go to the downloads section, and get the book called "Hard Drive Troubleshooting" (catchy name, eh?):
http://www.scsc-online.com
Their book describes a symptom that occurs on many computers (eventually) called "generic faults." A generic fault isn't an electronic component failure, it's actually a mechanical fault, such as cracked traces in logic boards, intermittent cable connections, etc. The intermittency of such a problem can delay and possibly prohibit the recognition of drives in their "normal" order.
Although SCSC touts their product Scannerz as being essentially useable by anyone, I think the product is likely best suited to technicians and engineers, or at least someone that has some understanding of hardware. In their book's advanced troubleshooting section, they talk about swapping out components the same way I change my shirt...most people know how to change their shirts, but not so many know how to cavalierly swap out a hard drive, particularly on a laptop.
The reason I say all this is that if your drive ID's are mysteriously changing their identities, you may have what they describe as an "intermittent generic fault" in their book, which is free by the way. Worth a look, anyway.
Hope this helps someone.