RHEL: Rebuilding the initial ramdisk image

RHEL: Rebuilding the initial ramdisk image

# Tested on RHEL 5, 6 & 7

# Sometimes it may be necessary to rebuild the initial ramdisk (also known as initrd or
# initramfs) to include new kernel modules, files, etc.


#
RHEL 3, 4 & 5: Rebuilding the initrd
# ------------------------------------------------------------------------------------------

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

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

# If we are in a kernel version different to the initrd we are building we must specify
# the full kernel version, without architecture:

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



#
RHEL 6 & 7: Rebuilding the initramfs
# ------------------------------------------------------------------------------------------

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

dracut -f

# If we are in a kernel version different to the initrd we are building we must specify
# the full kernel version, including architecture:

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


# *** Consider adding a new grub/grub2 entry pointing to the initial ramdisk image, that
#     will allow you to choose the old version at boot time without restoring the backup
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
O’Reilly’s CD bookshelf
Viewed 5844 times since Wed, Jun 27, 2018
Using stunnel and TinyProxy to obfuscate HTTP traffic
Viewed 2103 times since Fri, Sep 28, 2018
Linux - How to get CPU information
Viewed 693 times since Fri, Jun 8, 2018
RHEL: Extending the maximum inode count on a ext2/ext3/ext4 filesystem
Viewed 1320 times since Sun, May 27, 2018
3 Ways to Check Linux Kernel Version in Command Line
Viewed 1130 times since Fri, Apr 19, 2019
OEL 7 – How to disable IPv6 on Oracle Linux 7
Viewed 7558 times since Fri, Aug 3, 2018
Fałszujemy rozpoznania skanerów #1
Viewed 1357 times since Mon, May 21, 2018
How to automate SSH login with password? ssh autologin
Viewed 739 times since Fri, Jun 8, 2018
ubuntu How to reset lost root password on Ubuntu 16.04 Xenial Xerus Linux
Viewed 115 times since Tue, Dec 8, 2020
debian Debian/Ubuntu Linux: Find If Installed APT Package Includes a Fix/Patch Via CVE Number
Viewed 744 times since Sun, Sep 23, 2018