You are not logged in.

#1 2016-08-03 17:42:19

unable757
Member
Registered: 2016-04-03
Posts: 39

[Solved] How to change a partitions PARTUUID ?

I know tune2fs changes uuid by -U option. But how to change PARTUUID ?

Last edited by unable757 (2016-08-03 18:22:53)

Offline

#2 2016-08-03 18:01:31

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [Solved] How to change a partitions PARTUUID ?

With fdisk if it's a MBR partition, or gdisk (part of the gptfdisk package) if it's a GPT partition. In both programs, enter the expert menu by pressing x, then check the help to see what to press next.

Offline

#3 2016-08-03 18:03:43

frostschutz
Member
Registered: 2013-11-15
Posts: 1,417

Re: [Solved] How to change a partitions PARTUUID ?

The PARTUUID is in the GPT partition table so you need a partitioning program that can handle GPT. For example gdisk has this option hidden in its expert menu.

EIS shm # ls -l /dev/disk/by-partuuid/ | grep loop
lrwxrwxrwx 1 root root 13 Aug  3 20:01 37d1ecee-0ede-476a-8778-45c030e24c0a -> ../../loop0p1
EIS shm # gdisk /dev/loop0
GPT fdisk (gdisk) version 1.0.1

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

Expert command (? for help): c
Using 1
Enter the partition's new unique GUID ('R' to randomize): R
New GUID is 48F0EA9F-6DBD-4D1C-8942-67AD42B873D8

Expert command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/loop0.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
EIS shm # ls -l /dev/disk/by-partuuid/ | grep loop
lrwxrwxrwx 1 root root 13 Aug  3 20:01 48f0ea9f-6dbd-4d1c-8942-67ad42b873d8 -> ../../loop0p1

Deleting and re-creating the partition works too, you have to be careful to specify the exact same start/end sector and possibly also restore the partition type / name / label...

Offline

#4 2016-08-03 18:22:28

unable757
Member
Registered: 2016-04-03
Posts: 39

Re: [Solved] How to change a partitions PARTUUID ?

Thanks. Solved.

Offline

Board footer

Powered by FluxBB