Home
Posted By: Virtual1 what device is booted? - 04/22/15 06:55 PM
Anyone know of a way to tell which /dev/diskxxx is the startup?

I really don't need to know specifically which partition, but I need to weed out the startup volume's device from a partitioning list. And I can't find a good way to tell which DEV is booted from.

I was assuming /dev/disk0 was always the boot drive, but that's not the case. I just net booted while I had an external plugged in, and opened a terminal window from the netboot, only to find /dev/disk0 disappeared when I unplugged the external... (it's booted off /dev/disk1)

(and it's freaking out deploy studio too, which apparently was making a similar assumption, and may end up needing to be rerun)

What I've tried:

stat -f "%s" / -> gets me the device id of the boot volume
stat -f "%s" /dev/disk0 -> gets me some other weird device ID shared by all the devices.... tongue

diskutil list /dev/disk0 -> gets me a lot of info but not the device ID, nor whether or not it's booted, and I really can't rely on volume names to be unique identifiers, so nothing in that output is unique or completely reliable - important when partitioning disks!

any other ideas?
Posted By: MacManiac Re: what device is booted? - 04/23/15 01:38 AM
Have you tried <df> on the command line?

It shows /dev/disk1 as / (the boot volume).....in my case.
Posted By: artie505 Re: what device is booted? - 04/23/15 01:54 AM
Mine, too. (10.6.8)
Posted By: Virtual1 Re: what device is booted? - 04/23/15 11:46 AM
Originally Posted By: MacManiac
Have you tried <df> on the command line?
It shows /dev/disk1 as / (the boot volume).....in my case.

Ah thanks, that was simple enough! I guess I've never explored df much other than to see what the free/used/capacity of volumes was. I hadn't noticed it listed the mount points along with the devices. Handy!

(I've typed "df -ht hfs" more times than I care to count)
© FineTunedMac