-1

Does anybody have a solution to change the "Volume UUID" on Mac ?

I have this when using diskutil info from mac os x

deek5
  • 367
  • 1
  • 13
  • You answered this in [How can I change an NTFS Volume UUID?](https://apple.stackexchange.com/questions/229416/how-can-i-change-an-ntfs-volume-uuid) – user3439894 Jan 23 '18 at 18:00
  • An accuracy on the UUID offset in the MFT of an NTFS volume, 3320 or 3352. The difference comes from the origin of the formatting. If you format a hdd or vhd from Microsoft Windows, the offset for the UUID in the MFT will be 3352 bytes from the beginning of the MFT. If you format a volume or vhd from Mac OS X, with Diskutil the offset of the UUID will be 3320 bytes from the beginning of the MFT. All this for a volume (or vhd) NTFS of course. – deek5 Jun 06 '18 at 16:00

2 Answers2

1

Below is the applescript script to read UUID from an NTFS partition. All sudo are to be completed for your name and password, otherwise try removing the sudo. I do not advise you to modify the UUID, there is no information on their use. I left the inversion of the bytes in a very rudimentary way.

    set hdd to {}
set dmg to do shell script "sudo ls /dev/disk**s** " & " | sed -e 's#[[:space:]]*$##;s#\\/dev\\/##;/^$/d'" user name "Your_Name" password "Your_Password" with administrator privileges
set doun to ""
set dor to ""
set uuidd to ""
set uuidd to {}

set hfsountfs to ""
set theVol1 to ""
set theVol to ""
set vhd to ""
set leplus to 0
set levhd to ""
set hd to {}
set _Result to the paragraphs of dmg
set n to 0
set n to count _Result
set j to 1
do shell script "echo " & n

repeat with i from 1 to n
    set end of hdd to item i of _Result

end repeat

set theVolumeTemp to (choose from list hdd with prompt "Choisissez le Volume (partition) NTFS :" with empty selection allowed)
if theVolumeTemp is not false then

    set theVolumeTemp to do shell script "echo " & theVolumeTemp
    set theVol to "/dev/" & theVolumeTemp
    set theVol1 to theVol
    set theVol to do shell script "echo " & theVol & " | xxd -p | sed 's#0a##' | xxd -r -p "
    try
        set vhd to do shell script "diskutil info " & theVol & " | grep 'Disk Image' "
    end try
    try

        set uuidd to do shell script "diskutil unmount " & theVol
    end try
    set uuidd to do shell script "sudo dd if=" & theVol & " iseek=48 bs=1 count=8  | xxd -p " user name "Your_Name" password "Your_Password" with administrator privileges

    set theVol to do shell script "echo " & uuidd
    set n to 0
    set n to count uuidd
    do shell script "echo " & n

    repeat with i from 1 to 8
        set les2 to (item (n - 1) of uuidd & item n of uuidd)
        set end of hd to les2
        set n to n - 2
    end repeat
    set hd to do shell script "echo " & hd

    set nDec to (do shell script "perl -e 'printf(hex(\"" & hd & "\"))'") as integer
    if vhd is not "" then
        set leplus to 3320
        set levhd to "c'est un Vhd ntfs"
    else
        set leplus to 3352
    end if

    set nDec to do shell script " echo $((" & nDec & " * 4096 + " & leplus & "))" as string
    set uuidd to do shell script "sudo dd if=" & theVol1 & " iseek=" & nDec & " bs=1 count=16 | xxd -p " user name "Your_Name" password "Your_Password" with administrator privileges

    set hd to {}
    set n to 8
    repeat with i from 1 to 4
        set les2 to (item (n - 1) of uuidd & item n of uuidd)
        set end of hd to les2
        set n to n - 2
    end repeat

    set end of hd to "-"

    set n to 12
    repeat with i from 1 to 2
        set les2 to (item (n - 1) of uuidd & item n of uuidd)
        set end of hd to les2
        set n to n - 2
    end repeat

    set end of hd to "-"

    set n to 16
    repeat with i from 1 to 2
        set les2 to (item (n - 1) of uuidd & item n of uuidd)
        set end of hd to les2
        set n to n - 2
    end repeat
    set end of hd to "-"

    repeat with i from 17 to 20
        set end of hd to item (i) of uuidd
    end repeat
    set end of hd to "-"
    repeat with i from 21 to 32
        set end of hd to item (i) of uuidd
    end repeat
    set hd to do shell script "echo " & hd


    set lamft to do shell script " echo $((" & nDec & " - " & leplus & "))" as string



    set doun to " Identifiant Universel Unique ou UUID du " & theVolumeTemp & " est : 
" & hd

    set doun to doun & "
 La MFT du " & theVolumeTemp & " est à  :  " & lamft & " Octets du départ de la partition " & "
 l'UUID se trouve  plus loin de " & leplus & " Octets " & "
" & levhd
    set uuiddd to do shell script "sudo dd if=" & theVol1 & " iseek=72 bs=1 count=8  | xxd -p " user name "Your_Name" password "Your_Password" with administrator privileges
    set n to 0
    set n to count uuiddd
    do shell script "echo " & n
    set uuiddd to do shell script "echo " & uuiddd & "  | tr [:lower:] [:upper:] "
    set hdd to {}
    set les2 to (item 15 of uuiddd & item 16 of uuiddd & item 13 of uuiddd & item 14 of uuiddd)
    set end of hdd to les2
    set end of hdd to "-"
    set les2 to (item 11 of uuiddd & item 12 of uuiddd & item 9 of uuiddd & item 10 of uuiddd)
    set end of hdd to les2
    set end of hdd to "-"
    set les2 to (item 7 of uuiddd & item 8 of uuiddd & item 5 of uuiddd & item 6 of uuiddd)
    set end of hdd to les2
    set end of hdd to "-"
    set les2 to (item 3 of uuiddd & item 4 of uuiddd & item 1 of uuiddd & item 2 of uuiddd)
    set end of hdd to les2

    set doun to doun & " Le numero de série des 8 Octets de l'offset 72 partition NTFS du " & theVolumeTemp & " est : 
" & uuiddd & "
 Toujours présenté sous cette forme : " & hdd
    display alert (doun as string)

    try
        do shell script "diskutil mount " & theVol1

    end try

end if
deek5
  • 367
  • 1
  • 13
0

I am not sure about Mac but why would you use NTFS there. But for Windows you could try the Set-Disk powershell command with the -Guid parameter.

Cheers,
Gabriel

Gabriel Bercea
  • 1,191
  • 1
  • 10
  • 21