Creating a New Initial RAM Disk
If you have changed a motherboard or moved a disk to a different system it may fail to boot due to the lack of appropriate drivers in the initial RAM disk image (initrd).
Note: This article applies to CentOS-5 and earlier. CentOS-6 uses dracut and initramfs. Please see man dracut and the upstream Deployment Guide.
Boot in Rescue Mode
Please perform the following steps:
- Boot from a CentOS installation disc (for example, CD #1 or DVD).
Type "linux rescue" at the "boot:" prompt.
- Mount all filesystems in read-write mode.
Create the New Initrd
- Change root to real root ('/') on your hard disk and make the initrd. (The example is for the latest CentOS 5.5 kernel, as of this writing. Modify it for your current kernel.)
mount --bind /proc /mnt/sysimage/proc mount --bind /dev /mnt/sysimage/dev mount --bind /sys /mnt/sysimage/sys chroot /mnt/sysimage cd /boot mv initrd-2.6.18-194.32.1.el5.img initrd-2.6.18-194.32.1.el5.old.img mkinitrd initrd-2.6.18-194.32.1.el5.img 2.6.18-194.32.1.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-194.32.1.el5xen.img 2.6.18-194.32.1.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; sync; sync telinit 6
This page created and maintained by PhilSchaffner. Other Wiki contributors are invited to make corrections, additions, or modifications.
The page was inspired by this forum thread. Please see the thread for additional discussion.
