LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-04-2021, 02:24 PM   #1
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545

Rep: Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608
UUIDs & PARTUUIDs


I have been writing images for Arm boards to sdcards, a usb disk and even a 2.5" disk with dd. This is a recommended method. Partition 1 is vfat, partition 2 is ext4. But they are overwriting the UUID& PARTUUID, and copnsequently I have disks with the same uuid.

How does one change that? I would need to write different information, ideally without disturbing the contents.
 
Old 12-04-2021, 04:36 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 6,177

Rep: Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948
Quote:
Originally Posted by business_kid View Post
I have been writing images for Arm boards to sdcards, a usb disk and even a 2.5" disk with dd. This is a recommended method. Partition 1 is vfat, partition 2 is ext4. But they are overwriting the UUID& PARTUUID, and copnsequently I have disks with the same uuid.

How does one change that? I would need to write different information, ideally without disturbing the contents.
If two of those are never going to be mounted on the same machine at the same time it would not be fatal for them to use the same UUIDs. What is in your usage situation that requires them to be different?
 
Old 12-04-2021, 05:05 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,385

Rep: Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191
I can't believe a quick search wouldn't solve this immediately.
However, the point above is valid - I've never had a need to worry about it for my pi3s.
 
Old 12-05-2021, 05:01 AM   #4
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, OS/2, others
Posts: 6,501
Blog Entries: 1

Rep: Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232
tune2fs -U random /dev/blah will change the UUID to some random value on EXTx filesystems. I'm not familiar with any FOSS tool capable of changing the PARTUUID, but there should be one, as the non-FOSS partitioner I use can do it (I believe, not something I've tried).
 
1 members found this post helpful.
Old 12-05-2021, 06:16 AM   #5
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545

Original Poster
Rep: Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608
Thank you, mrmazda, that will do nicely, I think. Partition 2 is a root drive, and partition 1 is mounted on a subdirectory of that root, /boot. The danger for me is that on an Arm box, I will have two drives with identical uuids, and raspbian uses uuids.

I can't imagine users of lesser OSes being trustred with a partition manipulating tool like that. I could get into the partition with a hex editor, search for the uuid/partuuid and insert random stuff, but I'll let at least one crash happen first. Or I could change partition 1 to ext4, fix the uuids, return to fat and restore a backup of the files. That sounds lazier.

EDIT: Done it just now. Setting sdb2 sets the partuuid for all partitions, but the vfat uuid remains different.

Last edited by business_kid; 12-05-2021 at 06:27 AM.
 
Old 12-05-2021, 07:03 PM   #6
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Quote:
Originally Posted by business_kid View Post
Thank you, mrmazda, that will do nicely, I think. Partition 2 is a root drive, and partition 1 is mounted on a subdirectory of that root, /boot. The danger for me is that on an Arm box, I will have two drives with identical uuids, and raspbian uses uuids.

I can't imagine users of lesser OSes being trustred with a partition manipulating tool like that. I could get into the partition with a hex editor, search for the uuid/partuuid and insert random stuff, but I'll let at least one crash happen first. Or I could change partition 1 to ext4, fix the uuids, return to fat and restore a backup of the files. That sounds lazier.

EDIT: Done it just now. Setting sdb2 sets the partuuid for all partitions, but the vfat uuid remains different.
Almost every user can manipulate the UUID/GUID of a drive and its partitions. This from the man page for gdisk, expert menu
Code:
       c      Change partition GUID. You can enter a custom unique GUID for a partition using this option. (Note this refers  to
              the  GUID  that uniquely identifies a partition, not to its type code, which you can change with the 't' main-menu
              option.) Ordinarily, gdisk assigns this number randomly; however, you might want to adjust the number manually  if
              you've wound up with the same GUID on two partitions because of buggy GUID assignments (hopefully not in gdisk) or
              sheer incredible coincidence.


       f      Randomize the disk's GUID and all partitions' unique GUIDs (but not their partition type code GUIDs).  This  func‐
              tion may be used after cloning a disk with another utility in order to render all GUIDs once again unique.
I would recommend using gdisk, expert menu and the 'f' option on each device once the copy has been written to it. That changes the UUIDs for the device and partitions without affecting the data.

Last edited by computersavvy; 12-05-2021 at 07:06 PM.
 
Old 12-06-2021, 04:28 AM   #7
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545

Original Poster
Rep: Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608
What you suggested worked fine. Of course I have gdisk here, but I'll keep an eye on it if I dd over any more images. Will Gdisk handle vfat partitions formatted with fdisk?
 
Old 12-06-2021, 05:24 AM   #8
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, OS/2, others
Posts: 6,501
Blog Entries: 1

Rep: Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232Reputation: 2232
I suggest to read gdisk's man page to see how or whether it "handles" what you wish "handled", and look up the definition of VFAT. Most partitioners are not also formatters. Gdisk and fdisk are not formatters. Gdisk doesn't care if your FAT type partitions' filesystems are format extended with VFAT, but does treat FAT partitions designated as ESP specially. Any "handling" gdisk does to an existing formatted partition will most likely destroy the filesystem on the partition. Gdisk does not care or know whether fdisk created an existing partition.
 
Old 12-06-2021, 10:53 AM   #9
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Note that gdisk with the options I suggested does not affect stored data in any way. All they do is change the UUID of the disk and partition and that info is in the partition table, not in the filesystem data. Those options do not alter the partitions themselves, just the related UUID, so any risk of data loss is negligible.

If you are concerned then try the commands on a spare disk or flash drive and see for yourself if there is reason to worry.
 
Old 12-10-2021, 02:27 PM   #10
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545

Original Poster
Rep: Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608
As it turns out, this discussion was moot.

It transpired that a number of things chose that time to go dodgy or die. I'm also solving my UUID & PARTUUID issue. I disliked the chosen partition size so now I have been
  1. dd installation image to usb key
  2. rsync partition contents to their final resting places.
  3. Storing backups by partition, eg boot, root & home.
 
Old 12-10-2021, 03:18 PM   #11
framp
Member
 
Registered: Apr 2003
Location: Next to Stuttgart, Germany
Distribution: Debian, Mint, Raspbian
Posts: 132
Blog Entries: 5

Rep: Reputation: 27
Keep in mind to update the old PARTUUID in /boot/cmdline.txt and /etc/fstab. Otherwise your system will not boot.
 
Old 12-11-2021, 05:08 AM   #12
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545

Original Poster
Rep: Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608
Quote:
Originally Posted by framp View Post
Keep in mind to update the old PARTUUID in /boot/cmdline.txt and /etc/fstab. Otherwise your system will not boot.
Thank you for putting this in print. I'm getting extremely used to systems not booting here, unfortunately. It's actually inclined to be systems picking up the initrd but not /lib/modules, or /. I lack the energy to sort those matters out atm. But I have one that works, and one is enough.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't boot with 2 cloned hard drives, where UUIDs are different & GRUB specifies UUID ziphem Linux - Newbie 13 09-18-2011 04:42 PM
Can Ubuntu 7.10 be run without UUIDs? taylorkh Ubuntu 5 04-28-2008 12:23 PM
Phục hồi dữ liệu bị mất???, cứ pollsite General 1 06-27-2005 12:39 PM
generating uuids with uuid_gen ( libuuid ) jetley Linux - Newbie 0 05-19-2004 12:48 PM
Gotta love those ٱٱٱٱٱٱٱ&# iLLuSionZ Linux - General 5 11-18-2003 07:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration