LukeShortCloud / rootpages

Root Pages is a collection of easy-to-reference tutorials and guides primarily for Linux and other UNIX-like systems.
Other
56 stars 6 forks source link

[storage][file_systems] Change disk UUID #782

Open LukeShortCloud opened 2 years ago

LukeShortCloud commented 2 years ago

ext: tune2fs -U <UUID> /dev/<DEVICE> Btrfs: btrfstune -U <UUID> /dev/<DEVICE>

https://unix.stackexchange.com/questions/12858/how-to-change-filesystem-uuid-2-same-uuid

LukeShortCloud commented 1 year ago

ext* file systems must (1) run a FSCK first and (2) cannot be mounted.

$ sudo e2fsck -f /dev/<DEVICE><PARTITION>
$ sudo tune2fs -U $(uuidgen) /dev/<DEVICE><PARTITION>
LukeShortCloud commented 1 year ago

Actually, all file systems (regardless of type) require to be unmounted first.

LukeShortCloud commented 1 year ago

FAT* file systems must use the mlabel command and set a 8 digit serial to be used as the UUID.

$ sudo mlabel -N $(uuidgen | head -c8) -i  /dev/<DEVICE><PARTITION> ::

https://superuser.com/questions/1247972/how-to-change-vfat-partition-uuid

LukeShortCloud commented 1 year ago

exFAT:

$ sudo exfatlabel -i /dev/<DEVICE><PARTITION> <EIGHT_DIGIT_SERIAL_UUID>

https://github.com/exfatprogs/exfatprogs/issues/138#issuecomment-772904616