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
5 (1)
Article Rating (1 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
How to Configure ‘FirewallD’ in RHEL/CentOS 7 and Fedora 21
Viewed 11713 times since Wed, Oct 9, 2019
Installing and Configuring an OCFS2 Clustered File System
Viewed 6910 times since Sat, Jun 2, 2018
LVM: Extend an existing Volume Group by adding a new disk
Viewed 2757 times since Sat, Jun 2, 2018
RHEL: Getting/Setting hardware clock’s time
Viewed 4298 times since Sat, Jun 2, 2018
Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 7
Viewed 4187 times since Mon, Oct 29, 2018
RHEL: Adding a boot entry to GRUB/GRUB2 configuration
Viewed 6041 times since Sun, May 27, 2018
logrotate Log Rotate Configuration
Viewed 3993 times since Sun, Jan 12, 2020
How To: Linux Hard Disk Encryption With LUKS [ cryptsetup Command ]
Viewed 8373 times since Fri, Jul 13, 2018
Terminal based "The Matrix" like implementation
Viewed 4198 times since Thu, Apr 18, 2019
OEL 7 – How to disable IPv6 on Oracle Linux 7
Viewed 22029 times since Fri, Aug 3, 2018