Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to create a new initrd after a hardware change  (Read 3500 times)

0 Members and 1 Guest are viewing this topic.

Aby

  • Guest
How to create a new initrd after a hardware change
« on: April 07, 2014, 06:31:50 am »
How to create a new initrd after a hardware change ?

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 (initramfs for CentOS 6)

Boot in Rescue Mode

1.Boot from a CentOS installation disc (for example, CD #1 or DVD).
2.Type "linux rescue" at the "boot:" prompt.
3.Mount all filesystems in read-write mode.

Create the New Initramfs or Initrd

Change root to real root ('/') on your hard disk and make the new initramfs or initrd.

Code: [Select]
mount --bind /proc /mnt/sysimage/proc
mount --bind /dev /mnt/sysimage/dev
mount --bind /sys /mnt/sysimage/sys
chroot /mnt/sysimage

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

Code: [Select]
cp -p /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
Now create the initramfs for the current kernel:

Code: [Select]
dracut -f
If you need to build it for a specific kernel version (replace the version appropriately):

Code: [Select]
dracut -f /boot/initramfs-2.6.32-358.el6.x86_64.img 2.6.32-358.el6.x86_64
Note: 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

------