My tool working among 100 disks, some of them may attach or detach from the server during the tool running. I want to use disk's UUID as disk's id, and I got the question: If some disk disk_1
got a UUID, say 32c8da8b-e6d5-9a85-5cfc-1a8b59535263
. When it's space full, I detached the disk and formatted it (mkfs.ext3
), then re-attach to machine, will it's UUID change?
Is disk’s UUID a good identifier for disk
hard driveuuid
Related Topic
- Dramatic disk I/O performance difference for two disks on same machine
- Linux – Will UUID be the same if a disk moved from one machine to another
- Redhat – Identifying RHEL disk other than by UUID in /etc/fstab for Disaster Recovery from another site
- Change Instance UUID for VM in ESXi
- Is it better practice to buy RAID disks individually vs. in bulk
- Not Able to Get Swap Partition UUID After Creating with Parted Ansible Module
Best Answer
A filesystem's UUID is generated by mkfs, so a reformat will change the UUID.
One option is to create a label when you make the filesystem and look in
/dev/disk/by-label
rather than/dev/disk/by-uuid
. An advantage of using a label is that you can re-label a filesystem after the fact if you need to. A disadvantage is that you are now responsible for maintaining the labels and preventing collisions.