Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not getting UUID from diskutil on OSX

Tags:

uuid

osx-lion

Running Mac OSX 10.7.5 I want to enable NTFS on a USB3 external hard disk and need the UUID to do it (http://ntfsonmac.com) but diskutil is refusing to give me the UUID. I start with:

diskutil info /Volumes/HD-PCTU3/

then from this:

diskutil info disk2s1
   Device Identifier:        disk2s1
   Device Node:              /dev/disk2s1
   Part of Whole:            disk2
   Device / Media Name:      Untitled 1

   Volume Name:              HD-PCTU3
   Escaped with Unicode:     HD-PCTU3

   Mounted:                  Yes
   Mount Point:              /Volumes/HD-PCTU3
   Escaped with Unicode:     /Volumes/HD-PCTU3

   File System Personality:  NTFS
   Type (Bundle):            ntfs
   Name (User Visible):      Windows NT File System (NTFS)

   Partition Type:           Windows_NTFS
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 USB
   SMART Status:             Not Supported

   Total Size:               500.1 GB (500107804672 Bytes) (exactly 976773056 512-Byte-Blocks)
   Volume Free Space:        499.9 GB (499896778752 Bytes) (exactly 976360896 512-Byte-Blocks)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         Yes
   Ejectable:                Yes

   Whole:                    No
   Internal:                 No

but as can be seen there is no UUID displayed. Any ideas why and/or how to get the UUID?

like image 943
mercergeoinfo Avatar asked Jul 12 '13 10:07

mercergeoinfo


People also ask

How do I find the UUID on a Mac?

How to Find Your Mac's UUID. Click the Apple logo in the menu bar, and then click the “About This Mac” option. Click the “System Report” button. Note the text beside Hardware UUID.

What is file system UUID?

UUID is a unique identifier used in partitions to uniquely identify partitions in Linux operating systems. UUID is a property of the disk partition itself. So, if you install the hard drive containing the partitions on another Linux computer, the partitions will have the same UUID as before.


1 Answers

The only way I've been able to find involves a somewhat poorly documented feature of the hfs.util.

Run the diskutil command and then copy/remember/save the Device Identifier:

diskutil info /Volumes/my_drive_label | grep "Device Identifier" 

You can use the hfs.util with the Device Identifier (replacing disk2s1 below) from diskutil to (re)generate a UUID for your volume:

/System/Library/Filesystems/hfs.fs/hfs.util -s disk2s1

Keep in mind this won't work for every volume, if the volume is not an HFS drive than it may not work, and other Filesystem/*.fs/*.util commands may not have a -s verb to generate UUIDs.

UPDATE

In Yosemite and after the -s flag has been disabled at the source level. I haven't been able to find a pre-modified version of hfs.util, but you can do it yourself using the information found in this Superuser question, summarized here:

  1. Download the hfs.util source from Apple and extract it to a temporary folder
  2. Download hfs_fsctl.h from Apple and put it in the hfs.util folder
  3. Change line 47 of hfsutil_jnl.c into #include <hfs_fsctl.h>
  4. Change line 80 of hfsutil_main.c into #include <System/uuid/uuid.h>
  5. Change line 81 of hfsutil_main.c into static unsigned char kFSUUIDNamespaceSHA1[] = {0xB3,0xE2,0x0F,0x39,0xF2,0x92,0x11,0xD6,0x97,0xA4,0x00,0x30,0x65,0x43,0xEC,0xAC}; (replacing the include line)
  6. Also add #define HFS_UUID_SUPPORT 1 to hfsutil_main.c

There might still be something missing in the argument parsing section if the above doesn't work, please reference the Superuser question and comment if I've missed something.

Some people have also reported that it may be possible to use Gparted to change the UUID of a drive.

like image 103
Anthony Michael Cook Avatar answered Oct 15 '22 13:10

Anthony Michael Cook