An open community 
of Macintosh users,
for Macintosh users.

FineTunedMac Dashboard widget now available! Download Here

Topic Options
#33934 - 04/22/15 11:55 AM what device is booted?
Virtual1 Offline


Registered: 08/04/09
Loc: Iowa
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?
_________________________
I work for the Department of Redundancy Department

Top
#33941 - 04/22/15 06:38 PM Re: what device is booted? [Re: Virtual1]
MacManiac Online
Moderator

Registered: 08/04/09
Loc: Paradise....on the central Ore...
Have you tried <df> on the command line?

It shows /dev/disk1 as / (the boot volume).....in my case.
_________________________
Freedom is never free....thank a Service member today.

Top
#33943 - 04/22/15 06:54 PM Re: what device is booted? [Re: MacManiac]
artie505 Online


Registered: 08/04/09
Mine, too. (10.6.8)
_________________________
The new Great Equalizer is the SEND button.

In Memory Of Harv: Those who can make you believe absurdities can make you commit atrocities. ~Voltaire

Top
#33947 - 04/23/15 04:46 AM Re: what device is booted? [Re: MacManiac]
Virtual1 Offline


Registered: 08/04/09
Loc: Iowa
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)
_________________________
I work for the Department of Redundancy Department

Top

Moderator:  alternaut, dkmarsh, joemikeb