How to Find a Disk ID & Device Node Identifier in Mac OS X Command Line

Aug 9, 2016 - 6 Comments

Terminal in OS X

If you need to find the disk ID or disk node identifier (like /dev/disk0s2) of a volume attached to a Mac for one reason or another, perhaps the easiest way to obtain this information from the command line is with the diskutil utility.

Locating a Disk ID Node in Mac OS

Open the Terminal to get started, found in /Applications/Utilities/, and then enter the following syntax command string:

diskutil list

This command lists all of the mounted volumes and their respective partitions as we’ve discussed before, but for this purpose we’re using it specifically to locate the Disk ID, or IDENTIFIER of a volume. Thus, find the name of the disk volume in question, then look under the “IDENTIFIER” section to find the disk ID, it will appear on the right side of the terminal report:

diskutil list and find disk ID identifier information on Mac

As that command will print out all volumes and their disk identifiers, it can provide unnecessary information. If you don’t want to go through the list, or if you know the volume name of the drive you wish to find the Disk ID for directly, you can use a variation of the diskutil command to immediately get specifics this way:

diskutil info "Macintosh HD" |grep Node

This may return something like the following:
$ diskutil info "Macintosh HD" |grep Node
Device Node: /dev/disk1

Where “/dev/disk1” is the node identifier in question.

You can also broaden it a bit which may be helpful in determining which volume you’re looking for:

$ diskutil info "Macintosh HD" |grep Device
Device Identifier: disk1
Device Node: /dev/disk1
Device / Media Name: Macintosh HD
Device Block Size: 512 Bytes
Device Location: Internal

This points out where the device location is, meaning whether it’s an internal or external drive, which can help narrow dow a volume when you have many disks or storage utilities attached to a Mac.

The diskutil command is very powerful and has many uses for the Mac user who doesn’t mind navigating around within the command line. Yes, it’s a bit advanced, but given its potential and power, it’s sometimes the only way to get specific types of information quickly in MacOS and Mac OS X.

.

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS, Tips & Tricks

6 Comments

» Comments RSS Feed

  1. Craig Gaevert says:

    So . . I have two drives in a mac mini server. Disk Utility might report that one drive is bad or going bad along with its ID. How do I determine which drive it is without swapping them in and out? is, for example, DiskOs1 the top drive or the bottom drive?

    • Chuck Sullivan says:

      Use the system_profiler command.

      system_profiler -detaillevel mini

      The output will contain a section SATA/SATA Express with the BSD Name: disk0
      Bay Name: Lower

      Using that info you can determine where the failing disk is located in the mini

      • Eric says:

        Diskutil will output that info as well.

            diskutil info disk0

        Last row… (example)

            Device Location: “Bay 2”

  2. Wharf Xanadu says:

    This is great, I like Eriks tip too with mount it is a bit more direct. Thanks.

  3. Hamza Tariq says:

    I remember wasting hours in discovering this command few months back to make a copy of downloaded OS X version.

  4. Eric says:

    Another way to get the dik number is using “mount”

    alias disklist=’mount | grep “disk”‘

    # disklist
    /dev/disk2s2 on / (hfs, local, journaled)
    /dev/disk1s2 on /Volumes/Name1 (hfs, local, journaled)
    /dev/disk0s2 on /Volumes/Name2 Backup (hfs, local, journaled)
    /dev/disk0s3 on /Volumes/Name3 (hfs, local, journaled)
     
    :)

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site