3

This post is actually a continuation of this GParted answer.

I was trying to update/upgrade my Arch dual-boot with Windows, but my /boot partition was too small (100MB). So I expanded it with 1GB via GParted. Unfortunately for me, this is not the proper way of expanding a /boot partition.

@user1686 mentioned a solution though. However, I don't know how to properly execute any of the steps. Could anyone offer me more details?

Here are his instructions:

  1. Back up all files from the partition
    • How do I properly back files from a /boot partition?
  2. Reformat the /boot partition with mkfs.fat
    • How do I reformat it in this way? Can GParted do it?
  3. Copy files back into the /boot partition
    • How?

I wonder, though, if it isn't easier to simply use something like ArchLinux GUI install and hope it does a better job with the /boot partition.

By the way, I don't even know why the /boot partition was so small in my last install, this is the second time I install Arch in a dual-boot fashion — due to one of my Corsair RAM memories trashing my whole hardware —, and I don't remember having this problem back then.

0

1 Answer 1

3
+50

How do I properly back files from a /boot partition?

There's nothing special in the EFI (which is what at the /boot mount point by default), it's just a normal FAT partition like any other FAT data partitions. UEFI knows about file systems so fixing boot issues is very easy, no need to mess up with the boot sectors. Just do a normal copy like cp -r /boot /mnt/backup_folder or use the GUI in file explorer

But that requires you to mount the partition somehow. In this case the partition has been resized but the file system hasn't been resized yet, so I guess you can still mount it in Linux. If that's true then the above command is good to go. When restoring the files back in step 3 do the same copy in reverse direction

If you can't mount /boot then try copying just the exact old filesystem area to file and mount it as a loop device

sudo dd if=/dev/esp of=boot_partition.bin bs=1M count=100 # Copy the 100MiB partition
sudo mount -o loop boot_partition.bin /mnt/boot_backup

Then after it's mounted do cp -r /mnt/boot_backup /mnt/backup_folder

If the partition can't be mounted then don't worry, the boot files are available on all Linux and Windows installation disks. After creating the ESP, just plug the Windows/Linux installer medium in and copy them from /EFI into the new /boot partition for the step 3

Notice the folder structure in /EFI for those disks, but also don't worry too much, if the directory tree is wrong just open the EFI shell and select the correct boot loader you want to boot


How do I reformat it in this way? Can GParted do it?

I don't know if gparted can do it or not. As you already have the backed up data, just give it a try. If it fails then use mkfs.fat. You can check the man page for more information. The command would be like this

mkfs.fat -F 32 -s 1 -S 4096 /dev/your_boot_partition

You just need to care about the -S LOGICAL-SECTOR-SIZE and -s SECTORS-PER-CLUSTER options. You need to check your logical sector size by running fdisk -l. It's probably 4096 bytes for an NVMe, and in that case to get 4096-byte cluster use -s 1. If the device uses 512-byte sector then use -s 8 -S 512

2
  • Do you know why the EFI space happened to be so small? I don't remember if it was automatically done by Windows, which I installed first.
    – psygo
    Commented May 1, 2022 at 18:56
  • 1
    @PhilippeFanaro Windows creates a 100MB ESP on 512-byte-sector disks because there's no reason to make it large. Arch Linux is one of the rare cases where a large ESP is required because it stores kernels directly in the ESP by default. You can tell it not to do that way
    – phuclv
    Commented May 2, 2022 at 10:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .