【问题标题】:How change an NTFS Volume UUID如何更改 NTFS 卷 UUID
【发布时间】:2018-01-23 17:48:31
【问题描述】:

有没有人可以在 Mac 上更改“Volume UUID”的解决方案?

我在使用 mac os x 的 diskutil 信息时遇到了这个问题

【问题讨论】:

  • 你在How can I change an NTFS Volume UUID?回答了这个问题
  • NTFS 卷的 MFT 中 UUID 偏移的精度,3320 或 3352。差异来自格式化的来源。如果您从 Microsoft Windows 格式化 hdd 或 vhd,则 MFT 中 UUID 的偏移量将是 MFT 开头的 3352 个字节。如果您从 Mac OS X 格式化卷或 vhd,则使用 Diskutil,UUID 的偏移量将从 MFT 的开头开始 3320 字节。当然,所有这些都是针对卷(或 vhd)NTFS 的。

标签: macos terminal applescript uuid ntfs


【解决方案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

【讨论】:

    【解决方案2】:

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

    干杯,
    加布里埃尔

    【讨论】:

      猜你喜欢
      • 2019-08-06
      • 2013-07-22
      • 2012-07-05
      • 2011-02-13
      • 1970-01-01
      • 2010-09-06
      • 1970-01-01
      • 1970-01-01
      • 2015-04-17
      相关资源
      最近更新 更多