Re: UUID permanent at removable device?
Hi,
Hans wrote:
> I want to automatically create a bootable USB-stick using dd from an
> ISO-file.
The landscape of ISO files is wide and varied.
An URL for getting the ISO would help to make more specific statements.
> However, after generating the stick the UUID of the first partition
> (/dev/sdc1) is changing, so next time, the script will not work again,
> of course.
> But does the UUID also change of the device itself? Does the UUID of
> /dev/sdc change, too?
The UUID as of program lsblk is a property of the data which is stored
on the device, not of the device itself.
For example after dd'ing debian-12.0.0-amd64-netinst.iso :
$ lsblk -o NAME,UUID /dev/sdc
NAME UUID
sdc 2023-06-10-10-25-55-00
├─sdc1 2023-06-10-10-25-55-00
└─sdc2 DEB0-0001
Because there is no valid GUID Partition Table in this ISO, the UUIDs are
fabricated and don't deserve the attribute "Universially Unique".
sdc and sdc1 get the creation date of the ISO 9660 filesystem as Id.
sdc2 gets the Volume Serial Number of the FAT filesystem (just 4 bytes)
as UUID.
It does not look better with PARTUUID instead of UUID:
$ lsblk -o NAME,PARTUUID /dev/sdc1
NAME PARTUUID
sdc1 23261683-01
The shown id "23261683" is the hex representation of the MBR Disc
Signature which has 4 bytes.
> I want to dd it automatically like
> dd if=/path/to/my/image.iso of=UUID=34567890-afde-.....-1234
Consider refering to hardware properties, e.g. by using the symbolic links
in /dev/disk/by-id .
dd if=/path/to/my/image.iso \
of=/dev/disk/by-id/usb-INTENSO_USB_AA04012800007699-0:0
Device link name found by knowing that this time the USB stick is sdc:
$ ls -l /dev/disk/by-id
...
lrwxrwxrwx 1 root root 9 Nov 12 19:14 usb-INTENSO_USB_AA04012800007699-0:0 -> ../../sdc
...
Have a nice day :)
Thomas
Reply to: