How to recover /boot partition on RHEL or CentOS 7?
What if mistakenly you delete all the files from /boot partition or files got corrupted due to some reason !
You will see below error on the screen at the time of system boot. But there is a way to recover /boot partition files :)
Follow these steps to recover /boot partition :
Step 1 : Mount RHEL or CentOS 7 ISO image on your physical server and boot from it. In case you are using HPE Prolient server you can mount this ISO image on iLO, if this is virtual environment then mount it accordingly and reboot server or VM from ISO. Once rebooted you will see below options:
Step 2 : Scroll down and select "Troubleshooting" option from menu and PRESS "Enter"
Step 3 : Select "Rescue a CentOS system" and press ENTER:
Step 4 : Press ENTER key again to continue:
Step 5 : To continue, Type "1" and press ENTER, this will bring you to rescue mode, chroot sysimage filesystem using below command:
# chroot /mnt/sysimage
Step 6 : Next we will install 3 mandatory packages from the CentOS 7 iso:
Mount iso to a folder,
# mount /dev/cdrom /mnt
# cd /mnt/Packages
# rpm -ivh --force kernel-3.10.0-957.el7.x86_64.rpm
# rpm -ivh --force grub2-2.02-0.76.el7.centos.x86_64.rpm
# rpm -ivh --force centos-logos-70.0.6-3.el7.centos.noarch.rpm
Note: In case if you are trying to recover /boot on RHEL 7 then you will find "redhat-logos*.rpm" in-place of "centos-logos-70.0.6-3.el7.centos.noarch.rpm" package.
Step 7 : Install grub2 on the boot disk:
# grub2-install /dev/sda
In case you have multiple disks and you don't know on which disk you have /boot partition then use:
# cfdisk /dev/sda
Check all the disks one by one if /dev/sda is not the one you are looking for.
Step 8 : Once grub2 is installed on the disk then, then the last pending thing is to generate "grub.cfg":
# grub2-mkconfig -o /boot/grub2/grub.cfg
Once done, exit from the chroot and again exit to reboot the server.
Step 6 : Next we will install 3 mandatory packages from the CentOS 7 iso:
Mount iso to a folder,
# mount /dev/cdrom /mnt
# cd /mnt/Packages
# rpm -ivh --force kernel-3.10.0-957.el7.x86_64.rpm
# rpm -ivh --force grub2-2.02-0.76.el7.centos.x86_64.rpm
# rpm -ivh --force centos-logos-70.0.6-3.el7.centos.noarch.rpm
Note: In case if you are trying to recover /boot on RHEL 7 then you will find "redhat-logos*.rpm" in-place of "centos-logos-70.0.6-3.el7.centos.noarch.rpm" package.
Step 7 : Install grub2 on the boot disk:
# grub2-install /dev/sda
In case you have multiple disks and you don't know on which disk you have /boot partition then use:
# cfdisk /dev/sda
Check all the disks one by one if /dev/sda is not the one you are looking for.
Step 8 : Once grub2 is installed on the disk then, then the last pending thing is to generate "grub.cfg":
# grub2-mkconfig -o /boot/grub2/grub.cfg
Once done, exit from the chroot and again exit to reboot the server.
This worked perfectly! I only needed to re-install the kernel, but it saved my broken VM. Thank you!
ReplyDeletegastsormons-zu Brody Fokused https://wakelet.com/wake/GHltxBkx-fuKSv_Aa6Nj9
ReplyDeletegritapbrownez
hyddenos_ge Gregg Gant https://colab.research.google.com/drive/1qAiPfqxq65EDyiGYx2y1YKypWsilnHdw
ReplyDeletedownload
download
click
gurgrabelmai
OtarrarioseSioux Falls Dave Hundley Click
ReplyDeleteFree download
growlaytouchsders