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
Linux Network (TCP) Performance Tuning with Sysctl
Viewed 2596 times since Fri, Aug 3, 2018
How to remove CTRL-M (^M) characters from a file in Linux
Viewed 412 times since Thu, Feb 7, 2019
20 Practical Examples of RPM Commands in Linux rpm
Viewed 980 times since Mon, Feb 18, 2019
Red Hat ADDING SWAP SPACE
Viewed 524 times since Fri, Jun 8, 2018
debian How to Upgrade Debian 8 Jessie to Debian 9 Stretch
Viewed 630 times since Sun, Sep 23, 2018
UUIDs and Linux: Everything you ever need to know [Update]
Viewed 486 times since Tue, Jul 17, 2018
LVM: Create a new Logical Volume / Filesystem
Viewed 697 times since Sat, Jun 2, 2018
RHEL: Create a local RPM repository
Viewed 1062 times since Sun, May 27, 2018
Creating SWAP partition using FDISK & FALLOCATE commands
Viewed 270 times since Thu, Jan 16, 2020
20 Linux Command Tips and Tricks That Will Save You A Lot of Time linux
Viewed 1606 times since Thu, Apr 18, 2019