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?
2 Answers
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
-
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"– joerabbiApr 21, 2018 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.– dpbApr 22, 2018 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.– joerabbiApr 23, 2018 at 17:04
-
-
1Avoid using the
/dev/...
syntax inetc/fstab
. Per the man page formount
: "The recommended setup is to use tags (e.g. UUID=uuid) rather than /dev/disk/by-{label,uuid,partuuid,partlabel} udev symlinks in the /etc/fstab file. Tags are more readable, robust and portable." The reason tags are more robust is that the links in/dev/
links may change across reboots. For example,/dev/sdc
may become/dev/sdb
. The tags will not change unless you force them to by usingtune2fs
or something similar.– chrisDec 22, 2021 at 15:08
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.
PARTUUID=5678-03 /boot
without the"
's what you have to use infstab
.