Posts

Showing posts with the label troubleshooting

How to recover /boot partition on RHEL or CentOS 7?

Image
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: ...

Extending root partition size online in RHEL or CentOS 7

Why do we need to extend root partition size? There are couple of reasons that root filesystem should always be having free space, else: 1. Without free space programs and OS can crash. 2. No new services or application can be started on the server. 3. Can't write anymore data resulting DU Hence admin will be left with two options either remove unnecessary files and free up some space or extend root partition size online i.e. without impacting running application or downtime. Below detailed steps will help you to extend your root partition space online: Step 1. Check current root partition size: # df -kh Filesystem               Size  Used Avail Use% Mounted on /dev/mapper/centos-root   46G  6.1G   40G  14% / Here root partition is of "46GB". Step 2. Add a new disk and re-scan HBA's to discover it: # fdisk -l Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1...

Recovering or restoring grub in CentOS or RHEL 7

Image
What if GRUB is corrupted on your RHEL or CentOS 7 ? GRUB corruption is a common problem in RHEL or CentOS, which could occur due these reasons: If any file is missing or deleted from "/boot/grub2/" folder e.g. "grub.cfg" Mistakenly ran "dd" utility to clear boot sector Due to bad sector or corrupted disk Bad or incompatible firmware/driver installation  e.t.c. In case GRUB is corrupted, usually after powering on your server you see below kind of shell, also known as GRUB shell: Once you get to this prompt there is a way to restore or recover GRUB so that your system can boot up properly. To recover GRUB we need to have RHEL or CentOS 7 ISO image, which we usually use for OS installation. Make sure you mount same OS version iso image which is already installed on system. Below procedure will work only on BIOS based X86 servers and virtual machines. Follow these steps to recover GRUB: Step 1 : Mount RHEL or CentOS 7 ISO image ...

Recovering root user password in CentOS or RHEL 7

Image
What if you forget root user password?  RHEL/CentOS 7 has a way to recover root user password, but this will need downtime of your linux host. To recover your root user password follow below procedure as shown in screenshots: Step 1 :   Reboot host, come to GRUB screen and select Kernel without "rescue" option: PRESS "e" Step 2 :   Scroll your cursor down till you see line starting from " linux16 ".  Come  to the end of line after " UTF-8 " give a space and write " rd.break ": PRESS "CTRL + x", this will interrupt the boot process and leave you to the shell prompt : Step 3 : Once you come to shell prompt, remount "/sysroot" with "rw" permission i.e. read/write and then chroot to "/sysroot" directory: # mount -o remount,rw /sysroot/ # chroot /sysroot/ Step 4 :   Now we can go ahead and reset "root" user password using "passwd" comm...