i want change my usb disk uuid. but i dont understand the risk!
it means if i changed , it may not working?
i want change my usb disk uuid. but i dont understand the risk!
it means if i changed , it may not working?
Changing the UUID won't break the disk or make it unreadable. Some software might check UUIDs to try and detect unauthorised copying.
The risk I was referring to was the risk of making a mistake when running 'sudo dd' to read or write the superblock. That could definitely make the disk unreadable.
If it's that important, I suggest you backup the usb disk using gparted before changing the UUID. Please also read the dd manual page so you know what you're doing.Code:man dd
PS: To the thread moderator, my thanks.
This item has not yet been configured
Thank you! It worked perfectly for me on ubuntu 11.04
-strudel
I wrote a script to automate this process for NTFS partitions and to avoid overwriting anything that isn't NTFS (or at least reduce the risks). I'm sure one could modify it to work with FAT as well, but it's a starting point.
Code:#!/bin/dash IFS="" # echo with exit for error termination exho(){ echo "error: $1" exit 1 } # convert hexidecimal UUID to binary characters uuid2bin(){ STBF="$1" while [ -n "$STBF" ]; do BYTE="${STBF%??}" BYTE="${STBF#$BYTE}" STBF="${STBF%$BYTE}" BYTE="$(printf "%u\n" "0x$BYTE")" echo -n "$BYTE" | awk '{printf("%c",$0)}' done return 0 } # usage help if [ $# != 2 ]; then echo "$0 <UUID> <device>" exit 1 fi # test the input UUID for validity UUID_NEW="$(echo -n "$1" | tr [a-f] [A-F])" STBF="${UUID_NEW#[0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]}" if [ -n "$STBF" ]; then exho "invalid UUID format" fi if [ "$UUID_NEW" = 0000000000000000 ]; then exho "UUID cannot be empty" fi # get current/old UUID value via system tool UUID_OLD="$(blkid -c /dev/null -s UUID -o value "$2" 2>/dev/null)" if [ -z "$UUID_OLD" ]; then exho "could not read old UUID using blkid on $2" fi # get current/old UUID value via raw read STBF="$(dd bs=1 skip=72 count=8 if="$2" 2>/dev/null | hexdump -ve '1/1 "%02X"')" if [ ${#STBF} != 16 ]; then exho "could not read old UUID using dd on $2" fi # reorder the hex digits since they are reversed UUID_RAW="" while [ -n "$STBF" ]; do BYTE="${STBF%??}" BYTE="${STBF#$BYTE}" STBF="${STBF%$BYTE}" UUID_RAW="$UUID_RAW$BYTE" done # matching UUIDs confirm NTFS structure if [ "X$UUID_RAW" != "X$UUID_OLD" ]; then exho "$2 invalid NTFS device" fi # write UUID to device if ! uuid2bin "$UUID_NEW" | dd bs=1 seek=72 count=8 of="$2" 2>/dev/null && sync; then exho "could not write UUID to $2" fi # verify UUID UUID_RAW="$(blkid -c /dev/null -s UUID -o value "$2" 2>/dev/null)" if [ "X$UUID_RAW" != "X$UUID_NEW" ]; then exho "verification of new UUID failed" fi # status information echo "DEVICE:\t\t$2" echo "OLD UUID:\t$UUID_OLD" echo "NEW UUID:\t$UUID_NEW"
I have used this many times now and it works perfectly:
http://ubuntuforums.org/showpost.php...8&postcount=10
Bookmarks