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
RHEL: Reinstalling Boot Loader on the Master Boot Record (MBR)
Viewed 4521 times since Sun, May 27, 2018
Tunnel SSH Connections Over SSL Using ‘Stunnel’ On Debian 7 / Ubuntu 13.10
Viewed 4721 times since Fri, Sep 28, 2018
Linux - How to get IP and MAC address of ethernet adapter in Linux
Viewed 3605 times since Fri, Jun 8, 2018
Open SSL Creating Certificate Signing Request — CSR Generation
Viewed 2656 times since Mon, Feb 18, 2019
zabbix linux How to solve apache error No space left on device: Cannot create SSLMutex
Viewed 3452 times since Wed, Nov 11, 2020
RHEL: Resize/disable /dev/shm filesystem
Viewed 17056 times since Sun, May 27, 2018
Using grep to find string in files
Viewed 3394 times since Fri, May 15, 2020
Lsyncd: live file syncronization across multiple Linux servers
Viewed 8271 times since Wed, Oct 31, 2018
Extending Linux LVM partitions script
Viewed 7341 times since Wed, Feb 6, 2019
KONTO SFTP Z CHROOTEM Z UŻYCIEM OPENSSH-SERVER NA CENTOS/RHEL6
Viewed 2726 times since Fri, Nov 30, 2018