For disks with GPT partition table:
You can change the PARTUUID of a partition with gdisk
. I'd recommend to read man gdisk
first. In the following example I show how I changed the PARTUUID of the second partition on my first drive (sda):
$ sudo gdisk /dev/sda
[sudo] password for mook:
GPT fdisk (gdisk) version 1.0.5
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): x # enter x to change to experts menu
Expert command (? for help): c # enter c to change PARTUUID
Partition number (1-2): 2 # enter the number of the partition you want to change
Enter the partition's new unique GUID ('R' to randomize): r
New GUID is 76349364-D66C-4C19-B422-237A0D2DB9F5
Expert command (? for help): m # enter m to go back to main menu
Command (? for help): w # enter w to write the change to disk
Command (? for help): q # enter q to exit gdisk
$
For disks with msdos partition table:
For disks with msdos-partition-table blkid
produces a PARTUUID based on the Disk Signature
(Disk identifier) and the partition number (Source).
Different disks must always have different identifiers. See the files in /dev/disk/by-partuuid
which are links to the devices (e.g. /dev/sda1
). Both of your disks have the same identifier and only one partition and on both disks it's the first partition, this would theoretically result in two links with the same name but different targets in /dev/disk/by-partuuid
which is not possible at all. Probably this is the reason for your problems and you should definetely change one of the disk identifiers.
Here an example how we can change the disk signature using fdisk
:
First check the disk identifier with fdisk -l
:
~$ sudo fdisk -l /dev/sdc
[sudo] password for mook:
Disk /dev/sdc: 7.25 GiB, 7776239616 bytes, 15187968 sectors
Disk model: USB FLASH DRIVE
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x60123f75
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 15187967 15185920 7.2G 83 Linux
Now change the disk identifier with fdisk
:
~$ sudo fdisk /dev/sdc
[sudo] password for mook:
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): x # enter x to go to expert menu
Expert command (m for help): i # enter i to change identifier
Enter the new disk identifier: 0x60123f76
Disk identifier changed from 0x60123f75 to 0x60123f76.
Expert command (m for help): r # enter r to return to main menu
Command (m for help): w # enter w to write change to MBR
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Now recheck with fdisk -l
:
$ sudo fdisk -l /dev/sdc
Disk /dev/sdc: 7.25 GiB, 7776239616 bytes, 15187968 sectors
Disk model: USB FLASH DRIVE
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x60123f76
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 15187967 15185920 7.2G 83 Linux
home
disk is backuped to a nas disk (different fromstore
). The two disks have been working perfectly for nearly four years, but during the last reboot this accident happened.