Change UUID or serial number of a EXT4, swap, VFAT, FAT16 or FAT32 partition

Is it an EXT4 partition?

tune2fs -U "<UUID>" /dev/sdXY

Is it a swap partition?

If you have not used it, first do:
mkswap /dev/sdXY

swaplabel -U "<UUID>" /dev/sdXY

Is it a VFAT, FAT16 or FAT32 partition?

If you do not have mlabel, install it by:
apt install mtools

A FAT partition has a serial number in a format like XXXX-YYYY, in the command below omit the - from the serial number.

mlabel -N XXXXYYYY -i /dev/sdXY ::

Check UUID or serial number of a partition

blkid /dev/sdXY


This is a personal note. Last updated: 2021-01-05 22:02:54.


Don't forget to pay my friend a visit too. Joakim