5

I needed to increase the size of my boot partition (I already removed old kernels with autoremove). I increased the size of my drive (VM), and created a new partition. I did all things wonderful to make the new partition /boot. Blkid shows sda1 UUID=1234 PARTUUID=5678-01 and the new partition sda3 UUID=1234 PARTUUID=5678-03. I tried adding PARTUUID="5678-03" /boot to my fstab but it didn't boot (it works with /dev/sda3 /boot). Since partitions 1 and 3 are on the same disk (and the same UUID) how can I enter that in fstab?

  • I think it's PARTUUID=5678-03 /boot without the "'s what you have to use in fstab. – mook765 Apr 21 '18 at 9:01
2

As @mook765 mentions in comments, I think you can use PARTUUID, but just without quotes.

PARTUUID=5678-03 /boot [...]

Also, failing that, I think you can use the /dev/disk/by-partuuid/* symlinks that udev creates.

You may also want to use 'UUID', not 'PARTUUID'. Here's an example of the boot section of my fstab (this is the default of Ubuntu):

# /boot was on /dev/sda1 during installation
UUID=4e8a17a6-87ca-403b-9a1a-896d553e518c       /boot   ext3    defaults        0       2
UUID=7A56-4947  /boot/efi       vfat    defaults        0       1

To get the UUID of a block device:

sudo blkid /dev/sda1
/dev/sda1: LABEL="ubuntu-boot" UUID="4e8a17a6-87ca-403b-9a1a-896d553e518c" TYPE="ext3" PARTLABEL="ubuntu-boot" PARTUUID="57e3d2de-492b-4875-b110-76325e2401ec"

Just for example on another machine, you'll notice that each filesystem on the disk has a different UUID:

root@bierstadt:~# lsblk -o name,UUID /dev/sda
NAME                    UUID
sda                     
├─sda1                  8D99-B7B6
├─sda2                  147da7cf-c356-4ff9-a6fa-8fb555290b25
└─sda3                  1dd7ce7d-6de9-40e0-bd3f-5550ae40a588
  └─sda3_crypt          mAdSjw-3B31-Z7Im-WbCk-QmIP-b01M-5mFckC
    ├─ubuntu--vg-root   1b3d8c0f-2241-48c1-a272-39f8e683ccc9
    └─ubuntu--vg-swap_1 fd34789c-c65f-4253-a810-8183988e9760

Note the UUID comes with the filesystem. So, if you have cloned the partition, the UUID will come with it. You should probably change it if you want to mount it, or refer to it distinctly:

From this blog:

Since it is not possible to mount two file systems with the same UUID, extra care need to be taken when LVM snapshots (or cloned disks) are used in an environment: mounting might fail due to duplicate UUIDs. [...] One way to deal with this is by the way to change the UUID during creation or afterwards, another way is to mount with the nouuid option.

To change:

# tune2fs -U new_uuid /dev/sdaX

References

| improve this answer | |
  • Partition 1 and partition 3 are on the same drive and have the same UUID plus different PARTUUIDs. /dev/sda1: UUID="e7b59339-f325-4631-a4eb-2ed5f6b12c45" TYPE="ext4" PARTUUID="db623058-01" root@tjoe01:~# blkid /dev/sda3 /dev/sda3: UUID="e7b59339-f325-4631-a4eb-2ed5f6b12c45" TYPE="ext4" PARTUUID="db623058-03" – joerabbi Apr 21 '18 at 17:32
  • Check the updates on the question re: cloning, changing UUIDs, and the UUID coming with the Filesystem, not the partition, let me know if that helps. – dpb Apr 22 '18 at 0:19
  • Ok, that makes sense, since what I did was create a new partition on the same drive and then clone the old partition to the new partition. I will see if reformatting the old partition clears this up. Thanks. – joerabbi Apr 23 '18 at 17:04
  • Note that in fstab the UUID must be written in all lowercase. – rgov Oct 21 at 5:50
0

There were 2 partitions on this disk. I was trying to increase the size of my /boot partition. I added a new partition, umount'ed /boot and cloned it to the new partition. This left me with identical UUID's on 2 partitions. I did run tune2fs to create a random UUID for the old /boot partition. Note, I did have to run grub-install /dev/sda to fix grub and allow reboot. Alternately, I found I could fix grub and then add the old partition to the logical volume group to extend /, this also changed the UUID. thanks for the ideas.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.