Site icon Learning & Doing

Recovering CentOS OS – kernel panic

1.Boot in Rescue Mode
Boot from a CentOS installation disc (for example, CD #1 or DVD).
Type “linux rescue” at the “boot:” prompt.
2.Mount all filesystems in read-write mode. Example:  Burberry Outlet UK If you have on hda1 – boot and hdb1 – root partitions.

mount /dev/hdb1 /mnt/sysimage
mount /dev/hda1 /mnt/sysimage/boot

3.Create the New Initramfs or Initrd
4.Change root to real root (‘/’) on your hard disk and make the new initramfs or initrd.

mount –bind /proc /mnt/sysimage/proc
mount –bind /dev /mnt/sysimage/dev
mount –bind /sys /mnt/sysimage/sys
chroot /mnt/sysimage

Now you can change all configuration files. Ususally  Burberry Women have to check /boot/grub/grub.conf and /etc/fstab. Finally you can rebuild initrd.

For CentOS 6:
Create a backup copy of the current initramfs:

mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

Now create the initramfs for the current kernel:

dracut -f

If you need to build it for a specific kernel version (replace the version appropriately):

dracut -f /boot/initramfs-2.6.32-358.el6.x86_64.img 2.6.32-358.el6.x86_64

One useful option you might want to add is -H (–hostonly). With this option dracut installs only what is needed for booting your system. Otherwise dracut by default adds many drivers to the initramfs making its size larger than necessary. Many other options may be exercised. Please see man dracut, man dracut.conf and the upstream Deployment Guide.

For CentOS 5:
Create a backup copy of the current initrd:

mv /boot/initrd-$(uname -r).img /boot/initrd-$(uname -r).img.bak

Now create the initrd for the current kernel:

mkinitrd -f -v /boot/initrd-$(uname -r).img $(uname -r)

If you need to build it for a specific kernel version (replace the version appropriately):

mkinitrd -f -v /boot/initrd-2.6.18-371.el5.img 2.6.18-371.el5

If you are migrating a physical machine to a virtual one using the Xen hypervisor, replace the last command above with:

mkinitrd –with-xenblk initrd-2.6.18-371.el5xen.img 2.6.18-371.el5xen

Many other options may be exercised, such as adding non-loaded modules manually. See man mkinitrd for details. It may be necessary to modify /boot/grub/grub.conf and/or /etc/fstab depending on the details of your installation. This depends on your use of LABEL and/or UUID versus physical devices in the files, and is too complex an issue to get into in any detail in a TipsAndTricks article.

Reboot

cd /
sync
reboot

Sumber : http://karapetyan.us/recovering-centos-os-kernel-panic/

Exit mobile version