Ubuntu – Change hdd’s uuid

hard drive

I did a small research before making the question,but I couldn't find an answer.My question is how can I change the uuid (universally unique identifier) of a hard drive disk.I am asking this because every time I want to access a hard drive from terminal I have to find these random uuid which the system has generated automatically which are quite long.Also,I want to know the dangers of making this kind of change.

Best Answer

  • You can change a partition UUID or label, how to do so is dependent on the file system.

    For changing the label see

    https://help.ubuntu.com/community/RenameUSBDrive

    For changing the uuid, you can use uudigen and tune2fs

    uuidgen
    
    tune2fs /dev/hdb1 -U `uuid`
    

    Change "/dev/sdb1" to the device you wish to change the uuid on.

    You almost certainly will need to update /etc/fstab if you change the UUID on a partition that is mounted by fstab, such as / or /home or /swap

  • Related Question