如何更改NTFS卷UUID

时间:2018-01-23 17:48:31

标签: macos terminal applescript uuid ntfs

是否有人有解决方案来更改"卷UUID"在Mac上?

在使用mac os x中的diskutil信息时我有这个。

2 个答案:

答案 0 :(得分:1)

以下是从NTFS分区读取UUID的applescript脚本。所有sudo都将填写您的姓名和密码,否则请尝试删除sudo。我不建议你修改UUID,没有关于它们使用的信息。我以非常基本的方式离开了字节的反转。

    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

答案 1 :(得分:0)

我不确定Mac,但为什么你会在那里使用NTFS。 但对于Windows,您可以使用 -Guid 参数尝试Set-Disk powershell命令。

干杯,
加布里埃尔