User Tools

Site Tools


linux:backup-clone:uuid

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:backup-clone:uuid [2022/10/09 06:13] oscarlinux:backup-clone:uuid [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-====== UUID Information ====== 
  
----- 
-===== Be aware of UUID ===== 
-UUID stands for Universally Unique IDentifier of a partition. This ID is used in few different places to identify the partition. Most commonly this would be /etc/fstab. 
- 
-===== UUID vs PARTUUID ===== 
-  * **UUID** is a //filesystem-level// UUID, which is retrieved from the filesystem metadata inside the partition. It can only be read if the filesystem type is known and readable.  
-  * **PARTUUID** is a //partition-table-level// UUID for the partition, a standard feature for all partitions on GPT-partitioned disks. 
- 
- 
-You can get a few hints about the difference between UUID and PARTUUID by specifying the -p option. 
- 
-blkid -p /dev/sda1 
- 
- 
-UUIDs are not hardware-specific but stored in the partition's filesystem. That means cloning a disk or partition with dd will result in the same UUID. 
-However recreating the partitions manually on the new disk (e.g. smaller disk), will result in new UUID. This could result in problems when booting the new disk uses UUID in fstab. 
-<code> 
-cat /etc/fstab 
-# /etc/fstab: static file system information. 
-# <file system> <mount point>   <type>  <options>       <dump>  <pass> 
-# / was on /dev/sda3 during installation 
-UUID=b2fa29ee-670f-4d44-becc-d9ec368d4a41 /               ext4    noatime,nodiratime,errors=remount-ro 0       1 
-</code> 
-This can be solved by either changing the entries in fstab to the old style: /dev/dbX, Or by getting the new UUID and update fstab accordingy: 
-<code> 
-# blkid /dev/sdb1 
-/dev/sdb1: UUID="34628ffd-58e6-4a58-9b4d-533719305931" TYPE="ext4" PARTUUID="fa64ccff-01" 
-</code> 
- 
- 
- Assign UUID to partition using tune2fs. 
- 
-$ sudo tune2fs /dev/sdb1 -U 39ea80c4-e748-47eb-835c-64025de53e26 
-tune2fs 1.44.6 (5-Mar-2019) 
-Setting the UUID on this filesystem could take some time. 
-Proceed anyway (or wait 5 seconds to proceed) ? (y,N) y 
- 
-Check if UUID is properly assigned to the partition. 
- 
-$ sudo blkid /dev/sdb1 
-/dev/sdb1: UUID="39ea80c4-e748-47eb-835c-64025de53e26" TYPE="ext4" PARTUUID="2c6a7a3a-01" 
- 
- 
- 
-How to Change UUID of Your Filesystems 
- 
-Changing UUID of a filesystem is fairly easy. To do this, we are going to use tune2fs. For the purpose of this tutorial, I will change the UUID on my second partition /dev/sdb1, yours may vary, thus make sure you are changing the UUID of the desired filesystem. 
- 
-The partition has to be unmounted prior apply the new UUID: 
- 
-# umount /dev/sdb1 
-# tune2fs -U random /dev/sdb1  
-# blkid | grep sdb1 
- 
- 
- 
-Check the current UUID of the filesystem 
- 
-1. To find of the current UUID of the filesystem you can use either of the below commands. 
- 
-# blkid /dev/sdc1 
-/dev/sdc1: UUID="94ddf54e-53f7-4a1a-bd2f-d0a01ee448d1" TYPE="ext4" 
- 
-# dumpe2fs /dev/sdc1 | grep UUID 
-dumpe2fs 1.42.9 (28-Dec-2013) 
-Filesystem UUID:          94ddf54e-53f7-4a1a-bd2f-d0a01ee448d1 
- 
-You can also view the UUID in the file /etc/fstab, if there is an entry done manually for the filesyste. 
- 
-# grep data /etc/fstab 
-UUID="94ddf54e-53f7-4a1a-bd2f-d0a01ee448d1"       /data     ext4    defaults        0 2 
- 
- 
-==== change PARTUUID ==== 
-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): 
-<code> 
-$ 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 
-$ 
- 
-</code> 
linux/backup-clone/uuid.1665296007.txt.gz · Last modified: by oscar