How does one change the UUID of a Volume on Mac OS X 10.6?

7

2

Does anyone know how to change the UUID of a Volume? The background for this question is that I have a duplicate UUID issue:

I have /Volumes/OldMacHD with a UUID of XYZ. I have /Volumes/Mirror1 with a UUID of XYZ (same UUID! I bet that's because OldMacHD USED to be part of this mirror). I got these UUIDs via:

diskutil info /dev/thatdisknumber | grep UUID 

I’d like to change the UUID of Mirror1.

I discovered by chance the hfs.util utility, since these are HFS volumes after all. The man page for hfs.util says that if you issue the -s flag, this changes the UUID. However, if you type hfs.util all by itself, it doesn’t show you the -s option at all, just every option besides that! Grr. I tried it anyway:

sudo /System/Library/Filesystems/hfs.fs/hfs.util -s /dev/disk4 (the raid volume).  

Nothing happens. No error message, no success message. UUID exactly the same. I tried it while the volume was unmounted.

Any ideas?

Emmel

Posted 2010-04-03T22:58:43.047

Reputation: 351

Answers

3

the syntax for hfs.util appears to just be the devicename, not the path including /dev/

i.e.

Server:~ admin$ mount
(...)
/dev/disk1s2 on /Volumes/Backup (hfs, local, journaled)
(...)
Server:~ admin$ sudo /System/Library/Filesystems/hfs.fs/hfs.util -s rdisk1s2

make sure to unmount the drive before the hfs.util -s and mount afterwards.

use the "raw" device i.e. rdisk1s2 instead of disk1s2

diskutil info will not show the new uuid until you remount.

Daniel Zeller

Posted 2010-04-03T22:58:43.047

Reputation: 31

2In El Capitan, hfs.util is located in /System/Library/Filesystems/hfs.fs/Contents/Resources. – skozin – 2016-05-16T22:28:44.493

3

It should be doable. try using the hfs.util specifying the actual device id of the volume (if it's a raid volume you want the device id of the volume on the raid, not of any specific disk).

Alternatively use the little tool that is part of SuperDuper! so you can specify the path to a mounted volume.

The gory details of how the volume id is handled (which is actually not an UUID, the UUID is only used for display and is re-computed every time from the actual volume id) is explained in my answer to How does one change the UUID of a Volume on Mac OS X to a SPECIFIED value?

Analog File

Posted 2010-04-03T22:58:43.047

Reputation: 216

1

You can simply change UUID by partition format/erase.

1) Format disk to Mac OS Extended using built-in Disk Utility

2) If you need windows partition, format disk to exFAT after you have done first step (for some reason you need two steps for windows partition)

You can check if UUID changed by listing all UUID numbers:

find /Volumes -maxdepth 1 -mindepth 1 -exec diskutil info {} \;

laimison

Posted 2010-04-03T22:58:43.047

Reputation: 151

1

/dev/disk4 isn't an HFS volume, it's an entire drive, including the partition table and any number of separate volumes (partitions) on the drive. /dev/disk4s0 would be an example of a volume. Find the correct identifier for the actual HFS volume you care about, and try doing hfs.util -s on that.

Spiff

Posted 2010-04-03T22:58:43.047

Reputation: 84 656

0

All the examples I can find just take the device BSD name, not the full path to a device file. Have you tried that?

Hasaan Chop

Posted 2010-04-03T22:58:43.047

Reputation: 4 224

Yup, tried them both.

I ended up non-destructively killing and rebuilding the raid mirror in order to change the UUID, because nothing else worked.

Would be interesting to know how to do this for the future. – Emmel – 2010-04-04T16:21:28.653

Odds are good it's never been tested on a RAID setup. Try it on a single device, and if it still doesn't do anything, file a bug report. – Hasaan Chop – 2010-04-04T17:42:17.133

0

Easiest and most compatiable way I have found is with Gparted (can find the mac dmg on either sourceforge OR http://gparted.org) and manually selecting that partition /drive and editing the uuid that way

BUT with disk util (this works on both linux & Mac:

  1. insert drive

  2. select the gear and turn off auto mount

  3. in the newly editable boxes Change "Display Name" and then select (from "mount as") mount as UUID=foo

    • if nothing of value is left on this drive reformat and declare a Display Name and mount as "${Display Name} (which would be uuid=foo)
  4. (optional) if needed re-enable auto mounting

  5. reuse

  6. (optional) modify fstab to re-enter the mix of drives

linuxdev2013

Posted 2010-04-03T22:58:43.047

Reputation: 1 051