Moving /boot to a new partition

My current /boot is 500M. I ran out of space trying to upgrade from 42 to 43. I managed to free up enough space to get 43 working but there is only 4M free.

I created a 2G partition ext4 partition using gparted (/dev/nvme1n1p7). Then copied the files in /boot:

[root@localhost ~]# mount /dev/nvme1n1p7 /mnt
[root@localhost ~]# cp -ax /boot/* /mnt/

If I change the UUID in /etc/fstab and /boot/efi/EFI/fedora/grub.cfg to the UUID of the new partition will this be enough to boot from the new partition?

1 Like

Looks good to me.

Seems like I also need to run grub2-mkconfig after changing /boot/efi/EFI/fedora/grub.cfg.

Will I also have to re-install grub for it to find the new partition at boot time?

I believe that there is a simpler solution. Once you have moved the files to the new /boot partition, you need to dismount /boot/efi & /boot. Then edit /etc/fstab to use the new UUID for the new /boot.
Mount the partitions newly with sudo mount -a to ensure that it all will mount correctly.

If that all works then simply remove the file /boot/efi/EFI/fedora/grub.cfg and /boot/grub2/grub.cfg. Restore those 2 files with sudo dnf reinstall grub2-common which should rebuild both files with the updated info.

This should not be necessary since the boot occurs from the efi partition and you did not change the UUID of that partition.

Another possibly simpler solution could be to delete the old /boot partition and assign the UUID already in the efi grub.cfg file to the new partition. This would eliminate the need to alter fstab as well as the need to edit that grub.cfg file.

Thanks.

In solution #1 why is it necessary to umount /boot/efi and then (re)mount it to the same partition?

In the 2nd, is this the way to change a UUID: tune2fs -U ?

umount /boot/efi
umount  /boot 

lsblk -f

tune2fs -U  random  /dev/<oldbootdevice>  #  /dev/nvme1n1p5 (?) 
tune2fs -U 'UUID from the old /boot'  /dev/nvme1n1p7

#check with 
lsblk -f 

systemctl daemon-reload  (?)
mount -a

you could revert this process booting from a live image if that failed.
you also need to make sure that the selinux labels are applied correctly in the new /boot fs

sudo umount /boot will fail with “target is busy” if /boot/efi is still mounted.

From man tune2fs

       -U UUID
              Set  the  universally  unique identifier (UUID) of the file system to UUID.  The format of the UUID is a series of hex digits separated by
              hyphens, like this: "c1b9d5a2-f162-11cf-9ece-0020afc76f16".  The UUID parameter may also be one of the following:

                   clear  clear the file system UUID

                   random generate a new randomly-generated UUID

                   time   generate a new time-based UUID

              The UUID may be used by mount(8), fsck(8), and /etc/fstab(5) (and possibly others) by specifying UUID=uuid instead of a block special  de‐
              vice name like /dev/hda1.

I know nothing about this. How would I determine if this needed to be done? If it is, how do I do it?

[root@localhost /]# ls -Z
            system_u:object_r:mnt_t:s0 afs
            system_u:object_r:bin_t:s0 bin
           system_u:object_r:boot_t:s0 boot

tune2fs works on the old boot partition (/dev/nvme1n1p4) but not on the new boot partition (/dev/nvme1n1p7). Both are umount’d.

[root@localhost /]# e2fsck -f /dev/nvme1n1p4
e2fsck 1.47.3 (8-Jul-2025)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/nvme1n1p4: 103/128016 files (4.9% non-contiguous), 445955/512000 blocks
[root@localhost /]# tune2fs -U random /dev/nvme1n1p4
tune2fs 1.47.3 (8-Jul-2025)
Setting the UUID on this filesystem could take some time.
Proceed anyway (or wait 5 seconds to proceed) ? (y,N) <proceeding>
[root@localhost /]# e2fsck -f /dev/nvme1n1p7
e2fsck 1.47.3 (8-Jul-2025)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/nvme1n1p7: 148/131328 files (6.1% non-contiguous), 159770/524288 blocks
[root@localhost /]# tune2fs -U "9086ee6e-a92c-4eb2-9268-77289d097f03" /dev/nvme1n1p7
tune2fs 1.47.3 (8-Jul-2025)
[root@localhost /]# lsblk -f | fgrep n1p7

Also tried without quoting UUID:

[root@localhost /]# tune2fs -U 9086ee6e-a92c-4eb2-9268-77289d097f03 /dev/nvme1n1p7
tune2fs 1.47.3 (8-Jul-2025)
[root@localhost /]# lsblk -f | fgrep n1p4

this won’t work with a mounted fs.

besides. pls check efi on your new parition. I suspect that your command

cp -ax /boot/* /mnt/

will override -x because this is the same as

cp -ax /boot/efi   /boot/grub2 ...  /mnt 

use cp -ax /boot/ /mnt/ instead

use chcon to update selabels for /mnt if needed.

All files in old boot partition, including the selinux labels, were successfully copied to the new boot partition. Neither partition nor the EFI partition are currently mounted.

[root@localhost /]# lsblk | fgrep nvme1
nvme1n1                        259:0    0 931.5G  0 disk 
├─nvme1n1p1                    259:1    0   200M  0 part 
├─nvme1n1p2                    259:2    0  95.7G  0 part 
├─nvme1n1p3                    259:3    0 102.6G  0 part 
├─nvme1n1p4                    259:4    0   500M  0 part 
├─nvme1n1p5                    259:5    0 199.3G  0 part 
├─nvme1n1p6                    259:6    0 531.3G  0 part /shared
└─nvme1n1p7                    259:14   0     2G  0 part 
[root@localhost /]# tune2fs -U random /dev/nvme1n1p7
tune2fs 1.47.3 (8-Jul-2025)
[root@localhost /]# 

Sigh. Seems tune2fs works on the new partition after all — it just doesn’t give the warnings like it does on the old boot partition. So I, having never used this command before, assumed that it didn’t work

1 Like
ll /dev/disk/by-uuid/

udevadm trigger

ll /dev/disk/by-uuid/

you can also try partprobe if that above did not work

The UUID seen for nvme0n1p7 when you run lsblk -f should match the UUID seen in /etc/fstab.
from lsblk -f

nvme0n1                                                                                                           
├─nvme0n1p1           vfat              FAT32               52B5-5EC4                               470.7M     4% /boot/efi
├─nvme0n1p2           ext4              1.0                 c4eb1f4d-eaab-4b8a-a952-302402d8844d    577.3M    44% /boot

and from /etc/fstab

UUID=c4eb1f4d-eaab-4b8a-a952-302402d8844d /boot                   ext4    defaults        1 2

You need to put the proper UUID in the tune2fs command and not use random so the file system is properly identified.

I don’t remember seening that message before. So all good?

pls check that /boot/efi is empty when /boot/efi/ is umounted

Thanks. I was using tune2fs random on nvme1n1p7 because I didn’t think that it had worked (and typing “random” is easiter than “9086ee6e-a92c-4eb2-9268-77289d097f03”).

I think that I’m ready to reboot. Any missing steps?

[root@localhost /]# mount -a
[root@localhost /]# lsblk | fgrep nvme1
nvme1n1                        259:0    0 931.5G  0 disk 
├─nvme1n1p1                    259:1    0   200M  0 part /boot/efi
├─nvme1n1p2                    259:2    0  95.7G  0 part 
├─nvme1n1p3                    259:3    0 102.6G  0 part 
├─nvme1n1p4                    259:4    0   500M  0 part 
├─nvme1n1p5                    259:5    0 199.3G  0 part 
├─nvme1n1p6                    259:6    0 531.3G  0 part /shared
└─nvme1n1p7                    259:14   0     2G  0 part /boot

[root@localhost /]# ls /boot/efi
 EFI   mach_kernel   System  'System Volume Information'
[root@localhost /]# ls /boot
config-6.14.11-300.fc42.x86_64
config-6.17.5-300.fc43.x86_64
efi
extlinux
grub2
initramfs-0-rescue-e8c457d386574904952dd77da246c9d6.img
initramfs-5.6.12-300.fc32.x86_64-nouveau.img
initramfs-6.14.11-300.fc42.x86_64.img
initramfs-6.17.5-300.fc43.x86_64.img
loader
lost+found
memtest86+x64.efi
symvers-6.14.11-300.fc42.x86_64.xz
symvers-6.17.5-300.fc43.x86_64.xz
System.map-6.14.11-300.fc42.x86_64
System.map-6.17.5-300.fc43.x86_64
vmlinuz-0-rescue-e8c457d386574904952dd77da246c9d6
vmlinuz-6.14.11-300.fc42.x86_64
vmlinuz-6.17.5-300.fc43.x86_64
[root@localhost /]# 

umount /boot/efi
ls /boot/efi    


umount /boot 
dumpe2fs -h /dev/nvme1n1p7 |grep UUID