An open community 
of Macintosh users,
for Macintosh users.

FineTunedMac Dashboard widget now available! Download Here

Previous Thread
Next Thread
Print Thread
what device is booted?
#33934 04/22/15 06:55 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
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
Re: what device is booted?
Virtual1 #33941 04/23/15 01:38 AM
Joined: Aug 2009
Likes: 5
Moderator
Offline
Moderator

Joined: Aug 2009
Likes: 5
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.
Re: what device is booted?
MacManiac #33943 04/23/15 01:54 AM
Joined: Aug 2009
Likes: 15
Online

Joined: Aug 2009
Likes: 15
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
Re: what device is booted?
MacManiac #33947 04/23/15 11:46 AM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
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

Moderated by  alternaut, dkmarsh, joemikeb 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.4.33 Page Time: 0.016s Queries: 22 (0.012s) Memory: 0.5844 MB (Peak: 0.6423 MB) Data Comp: Zlib Server Time: 2024-03-29 15:39:59 UTC
Valid HTML 5 and Valid CSS