RHEL UEFI disk restore is missing /boot/grub2 content
search cancel

RHEL UEFI disk restore is missing /boot/grub2 content

book

Article ID: 221101

calendar_today

Updated On:

Products

Ghost Solution Suite

Issue/Introduction

Ghost and gdisk version...
Broadcom Ghost 12.0.0 (build=11381). Built on Jul  7 2021 04:16:39.
Copyright (C) 2021 Broadcom Inc. All rights reserved.

Symantec GDisk 12.0.0 (build=11343). Built on Mar 26 2021 05:19:18.
Copyright (C) 2021 Broadcom Inc. All rights reserved.

When capturing a UEFI RHEL 8.2 server with the following layout and content:

[root@rulaque ~]# blkid
/dev/sda1: SEC_TYPE="msdos" UUID="C22D-2E15" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="d5f25412-7a30-490b-a7d4-615f1a399fa5"
/dev/sda2: UUID="d4207f1c-8d39-4c5d-b8ef-759f096daa6f" TYPE="xfs" PARTUUID="4ef540d2-b844-4342-8be0-e515a73e558a"
/dev/sda3: UUID="ff9bd518-420f-48de-bdd5-20ea6691c295" TYPE="swap" PARTUUID="ee2eb4e0-defe-4606-abaa-b9cd484b4a02"
/dev/sda4: UUID="bb3c5410-38b5-41f5-a6be-308543f8e185" TYPE="xfs" PARTUUID="86824ba8-0ae2-4f81-a939-d34229e8bcd0"
[root@rulaque ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs         32G     0   32G   0% /dev
tmpfs            32G     0   32G   0% /dev/shm
tmpfs            32G   34M   32G   1% /run
tmpfs            32G     0   32G   0% /sys/fs/cgroup
/dev/sda4       557G   10G  547G   2% /
/dev/sda2       238M  148M   91M  62% /boot
/dev/sda1       250M  6.8M  243M   3% /boot/efi
tmpfs           6.3G     0  6.3G   0% /run/user/0
[root@rulaque ~]# tree /boot/efi/
/boot/efi/
└── EFI
    ├── BOOT
    │   ├── BOOTX64.EFI
    │   └── fbx64.efi
    └── redhat
        ├── BOOTX64.CSV
        ├── fonts
        ├── grub.cfg
        ├── grubenv
        ├── grubx64.efi
        ├── mmx64.efi
        ├── shimx64.efi
        └── shimx64-redhat.efi
There are 4 directories and 9 files:
[root@rulaque ~]# file /boot/efi/EFI/redhat/grubenv 
/boot/efi/EFI/redhat/grubenv: ASCII text, with very long lines
[root@rulaque ~]# cat /boot/efi/EFI/redhat/grubenv 
# GRUB Environment Block
saved_entry=cf3af0e0decd4ceca7dbf7fdaa9bb01b-4.18.0-193.el8.x86_64
kernelopts=root=UUID=bb3c5410-38b5-41f5-a6be-308543f8e185 ro crashkernel=auto resume=UUID=ff9bd518-420f-48de-bdd5-20ea6691c295 nomodeset biosdevname=0 net.ifnames=0 
boot_success=0
###############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################[root@rulaque ~]#

After doing a restore, the disk content seen is:

[root@imagemobility ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs         31G     0   31G   0% /dev
tmpfs            32G  4.0K   32G   1% /dev/shm
tmpfs            32G  2.3G   30G   8% /run
tmpfs            32G     0   32G   0% /sys/fs/cgroup
/dev/loop0      726M  726M     0 100% /run/initramfs/live
/dev/loop3      3.9G  2.3G  1.6G  60% /
tmpfs            32G   12K   32G   1% /tmp
vartmp           32G     0   32G   0% /var/tmp
tmpfs           6.3G     0  6.3G   0% /run/user/0
s3fs            256T     0  256T   0% /mnt/COS
/dev/sda1       250M  6.8M  243M   3% /mnt/dev/sda1
/dev/sda2       238M  148M   91M  62% /mnt/dev/sda2
/dev/sda4       557G   10G  547G   2% /mnt/dev/sda4
[root@imagemobility ~]# blkid
/dev/loop0: BLOCK_SIZE="2048" UUID="2021-07-12-19-14-56-00" LABEL="ISOIMAGE" TYPE="iso9660"
/dev/sda1: SEC_TYPE="msdos" UUID="C22D-2E15" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="3185a901-87c1-11d7-af64-bd04d09cf5d6"
/dev/sda2: UUID="d4207f1c-8d39-4c5d-b8ef-759f096daa6f" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="3185a903-87c1-11d7-af64-bd04d09cf5d6"
/dev/sda3: UUID="ff9bd518-420f-48de-bdd5-20ea6691c295" TYPE="swap" PARTUUID="3185a905-87c1-11d7-af64-bd04d09cf5d6"
/dev/sda4: UUID="bb3c5410-38b5-41f5-a6be-308543f8e185" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="3185a907-87c1-11d7-af64-bd04d09cf5d6"
/dev/loop1: TYPE="squashfs"
/dev/loop2: LABEL="_image_mobility" UUID="39fc86fa-967a-4c2b-8257-1198a5c437f0" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/live-rw: LABEL="_image_mobility" UUID="39fc86fa-967a-4c2b-8257-1198a5c437f0" BLOCK_SIZE="4096" TYPE="ext4"
/dev/loop3: LABEL="_image_mobility" UUID="39fc86fa-967a-4c2b-8257-1198a5c437f0" BLOCK_SIZE="4096" TYPE="ext4"
[root@imagemobility ~]# tree /mnt/dev/sda2/
/mnt/dev/sda2/
├── config-4.18.0-193.el8.x86_64
├── efi
├── grub2
│   └── grubenv -> ../efi/EFI/redhat/grubenv
├── initramfs-0-rescue-cf3af0e0decd4ceca7dbf7fdaa9bb01b.img
├── initramfs-4.18.0-193.el8.x86_64.img
├── initramfs-4.18.0-193.el8.x86_64kdump.img
├── loader
│   └── entries
│       ├── cf3af0e0decd4ceca7dbf7fdaa9bb01b-0-rescue.conf
│       └── cf3af0e0decd4ceca7dbf7fdaa9bb01b-4.18.0-193.el8.x86_64.conf
├── System.map-4.18.0-193.el8.x86_64
├── vmlinuz-0-rescue-cf3af0e0decd4ceca7dbf7fdaa9bb01b
└── vmlinuz-4.18.0-193.el8.x86_64
Now there are 4 directories and 10 files
[root@imagemobility ~]# file /mnt/dev/sda2/grub2/grubenv 
/mnt/dev/sda2/grub2/grubenv: broken symbolic link to ../efi/EFI/redhat/grubenv
[root@imagemobility ~]#

After restoring, the efi directory is missing content and the grubenv has been changed from an ASCI file to a symbolic link.

Environment

Release: GSS 3.3

Resolution

Found that a mistake had been made in understanding the directory structure; the /boot/efi was on /dev/sda1 and not /dev/sda2 and the command lines used were looking for the data on the wrong partition.