Failed Disk on Linux Dedicated Servers with EFI partition

Hello,

I have several dedicated servers with Linux in RAID 1. Some servers have an EFI partition and some do not.

Now its time to change a failed disk on a server with an EFI partition and the damaged disk has the EFI partition and mounted in /boot/efi and my surprise is that the procedures for changing the OVHcloud disk dont mention the partitions EFI.

https://help.ovhcloud.com/csm/en-dedicated-servers-disk-replacement?id=kb_article_view&sysparm_article=KB0043410
https://help.ovhcloud.com/csm/en-dedicated-servers-raid-soft?id=kb_article_view&sysparm_article=KB0043935

I have read this topic https://community.ovhcloud.com/t/4429 very similar to my case but it is in Windows. I have Linux. The failed disk had the active EFI partition and after the change the server obviously does not start.

I do not understand how OVHcloud does not give details in its procedures and its technical support does not explain that the EFI partition is included in both disks.

What would be the procedure to replace the damaged disk?
Simply unmount and mount /boot/efi on the other partition on the non-corrupted disk?

Greetings.

Hello &#64;VincentG1. Can you give me a way to identify your server (ID, mac address, server name)?<br />Also, can you show me the output of &#96;lsblk -f -o &#43;SIZE&#96; and tell me which disk was replaced?<br /><br />In general, to reinstall the bootloader, you should boot into rescue, mount the &#96;/&#96; partition of your OS in &#96;/mnt&#96;, then:<br />&#96;&#96;&#96;text<br />mount --types proc /proc /mnt/proc<br />mount --rbind /sys /mnt/sys<br />mount --make-rslave /mnt/sys<br />mount --rbind /dev /mnt/dev<br />mount --make-rslave /mnt/dev <br />&#96;&#96;&#96;<br />After that, chroot into &#96;/mnt&#96; and reinstall GRUB, <br />&#96;&#96;&#96;text<br />chroot /mnt<br />mount -a<br /># Passing No NVRAM prevents GRUB from changing the boot order, which is important<br /># because your server needs to boot with PXE first for the rescue to work<br />grub-install --target&#61;x86_64-efi --efi-directory&#61;/boot/efi --no-nvram<br />&#96;&#96;&#96;<br /><br />**All my commands assume that you have a working EFI system partition (ESP).** If you don&#39;t, you need to create one with e.g. parted:<br />&#96;&#96;&#96;text<br />parted /dev/sdX<br /># then create an ESP<br />mkfs.vfat -F32 /dev/sdX1 # assuming the ESP is the first partition<br />fatlabel /dev/sdX1 EFI_SYSPART # optional but our installer uses this label to mount the ESP in /etc/fstab<br />&#96;&#96;&#96;<br /><br />I suggest that you create ESPs on all the disks of your server. Then you can use this kind of script to sync them (assuming they have the aforementioned label): https://community.ovh.com/t/Partition-EFI-sur-raid-apr%C3%A8s-changement-de-disque/60512/9<br />&#96;&#96;&#96;sh<br />#!/bin/bash<br />set -euo pipefail<br /><br />MAIN_PARTITION&#61;&#34;$(findmnt -n -o SOURCE /boot/efi)&#34;<br />MOUNTPOINT&#61;&#34;/var/lib/grub/esp&#34;<br /><br />mkdir -p &#34;${MOUNTPOINT}&#34;<br /><br />while read -r partition; do<br />    if [[ &#34;${partition}&#34; &#61;&#61; &#34;${MAIN_PARTITION}&#34; ]]; then<br />        continue<br />    fi<br />    echo &#34;Working on ${partition}&#34;<br />    mount &#34;${partition}&#34; &#34;${MOUNTPOINT}&#34;<br />    rsync -ax &#34;/boot/efi/&#34; &#34;${MOUNTPOINT}/&#34;<br />    umount &#34;${MOUNTPOINT}&#34;<br />done &lt; &lt;(blkid -o device -t LABEL&#61;EFI_SYSPART)<br />&#96;&#96;&#96;
Hello &#64;VincentG1. Can you give me a way to identify your server (ID, mac address, server name)?<br />Also, can you show me the output of &#96;lsblk -f -o &#43;SIZE&#96; and tell me which disk was replaced?<br /><br />In general, to reinstall the bootloader, you should boot into rescue, mount the &#96;/&#96; partition of your OS in &#96;/mnt&#96;, then:<br />&#96;&#96;&#96;text<br />mount --types proc /proc /mnt/proc<br />mount --rbind /sys /mnt/sys<br />mount --make-rslave /mnt/sys<br />mount --rbind /dev /mnt/dev<br />mount --make-rslave /mnt/dev <br />&#96;&#96;&#96;<br />After that, chroot into &#96;/mnt&#96; and reinstall GRUB, <br />&#96;&#96;&#96;text<br />chroot /mnt<br />mount -a<br /># Passing No NVRAM prevents GRUB from changing the boot order, which is important<br /># because your server needs to boot with PXE first for the rescue to work<br />grub-install --target&#61;x86_64-efi --efi-directory&#61;/boot/efi --no-nvram<br />&#96;&#96;&#96;<br /><br />**All my commands assume that you have a working EFI system partition (ESP).** If you don&#39;t, you need to create one with e.g. parted:<br />&#96;&#96;&#96;text<br />parted /dev/sdX<br /># then create an ESP<br />mkfs.vfat -F32 /dev/sdX1 # assuming the ESP is the first partition<br />fatlabel /dev/sdX1 EFI_SYSPART # optional but our installer uses this label to mount the ESP in /etc/fstab<br />&#96;&#96;&#96;<br /><br />I suggest that you create ESPs on all the disks of your server. Then you can use this kind of script to sync them (assuming they have the aforementioned label): https://community.ovh.com/t/Partition-EFI-sur-raid-apr%C3%A8s-changement-de-disque/60512/9<br />&#96;&#96;&#96;sh<br />#!/bin/bash<br />set -euo pipefail<br /><br />MAIN_PARTITION&#61;&#34;$(findmnt -n -o SOURCE /boot/efi)&#34;<br />MOUNTPOINT&#61;&#34;/var/lib/grub/esp&#34;<br /><br />mkdir -p &#34;${MOUNTPOINT}&#34;<br /><br />while read -r partition; do<br />    if [[ &#34;${partition}&#34; &#61;&#61; &#34;${MAIN_PARTITION}&#34; ]]; then<br />        continue<br />    fi<br />    echo &#34;Working on ${partition}&#34;<br />    mount &#34;${partition}&#34; &#34;${MOUNTPOINT}&#34;<br />    rsync -ax &#34;/boot/efi/&#34; &#34;${MOUNTPOINT}/&#34;<br />    umount &#34;${MOUNTPOINT}&#34;<br />done &lt; &lt;(blkid -o device -t LABEL&#61;EFI_SYSPART)<br />&#96;&#96;&#96;

Hello le_sbraz.

Thanks for answering my problem.

The server is SYS-4-SAT-32 model and is installed with the OVH template for AlmaLinux 8. And it has the following:
> lsblk -f -o +SIZE
NAME FSTYPE LABEL UUID MOUNTPOINT SIZE
sda 3.7T
├─sda1 vfat EFI_SYSPART EF0E-C887 511M
├─sda2 linux_raid_member md2 f317bad5-4b94-034e-a640-d9cbb24f8050 2G
│ └─md2 xfs boot d4035efa-5696-4705-be1d-b56e58a14c02 /boot 2G
├─sda3 linux_raid_member md3 12434b96-6f9a-6dcd-8b0c-97c9e18d2ab8 3.6T
│ └─md3 xfs root 0a570fa3-38c7-47f5-9757-e084a26b615b / 3.6T
├─sda4 swap swap-sda4 ac6c7cc4-13bd-4aa0-adec-4b4a87eb15d3 [SWAP] 32G
├─sda5 linux_raid_member md5 bfdc8c44-5b8d-094c-f687-e0397409b42d 25G
│ └─md5 xfs tmp 14df1268-b3aa-4878-9b2c-efd7f3c223d3 /home/virtfs/fmao/var/tmp 25G
└─sda6 iso9660 config-2 2024-07-03-23-30-14-00 2M
sdb 3.7T
├─sdb1 vfat EFI_SYSPART EF1B-9D7C /boot/efi 511M
├─sdb2 linux_raid_member md2 f317bad5-4b94-034e-a640-d9cbb24f8050 2G
│ └─md2 xfs boot d4035efa-5696-4705-be1d-b56e58a14c02 /boot 2G
├─sdb3 linux_raid_member md3 12434b96-6f9a-6dcd-8b0c-97c9e18d2ab8 3.6T
│ └─md3 xfs root 0a570fa3-38c7-47f5-9757-e084a26b615b / 3.6T
├─sdb4 swap swap-sdb4 42e473b1-4cd7-481a-9777-3257e2f4a573 [SWAP] 32G
└─sdb5 linux_raid_member md5 bfdc8c44-5b8d-094c-f687-e0397409b42d 25G
└─md5 xfs tmp 14df1268-b3aa-4878-9b2c-efd7f3c223d3 /home/virtfs/fmao/var/tmp 25G

As you can see in sda it has sda1 which has the same size as sdb1. sdb1 has /boot/efi mounted and it is sdb the failed disk and should be replaced.

I don't know what function the sda6 partition has either.

Regards.

@VicenteG1 how did you go with this? i see the same issue the in the image they provide the /boot/efi is not on the soft raid. this is surely to cause a problem in the event of a hard drive failure and negates the redundancy of the raid really.

Hello @tazau

They have not given me a solution to the problem that I have presented.

OVH has not told me how to proceed when I have used their own installation template. They have not been able to explain to me what function sda1 vfat EFI_SYSPART EF0E-C887 511M has.

All servers installed with the OVH template will be the same.

Regards.