• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Rebuild the “initramfs” with Multipath in CentOS/RHEL 6 and 7

by admin

The initramfs contains kernel modules for all hardware that is required to boot, as well as the initial scripts required to proceed to the next stage of booting. On CentOS/RHEL system, the initramfs contains a complete operational system (which may be used for troubleshooting purposes).

Occasionally, the initramfs image may get damaged as well. If this happens, you cannot boot your server into normal operational mode. To repair the initramfs image after booting into the rescue environment, you can use the dracut command. If used with no arguments, this command creates a new initramfs for the kernel currently loaded.

Alternatively, you can use the dracut command with several options to make an initramfs for specific kernel environments. There is also a configuration file with the name /etc/dracut.conf that you can use to include specific options while re-creating the initramfs.

Backup initramfs

Always make a backup of the current initramfs image in case there are issues with the new version created.

# cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.$(date +%m-%d-%H%M%S).bak

Rebuild initramfs with multipath

Rebuild the initramfs image with multipath, execute the dracut command with the following options:

CentOS/RHEL 6

# dracut -v -f -a multipath --include /etc/multipath /etc/multipath

CentOS/RHEL 7

# dracut --force --add multipath --include /etc/multipath

Verify

Verify the new initramfs image was created in /boot directory:

# ls -lrt /boot/initramfs-$(uname -r).img

Reboot

Reboot the system with the newly created initramfs image.

# reboot

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. jq: command not found (JSON CLI Parser)
  2. How to Reset Root Password in CentOS/RHEL 8
  3. “yum history” command examples to display, rollback, redo, undo yum transactions
  4. CentOS / RHEL 7 : How to extract initramfs image and edit/view it
  5. How to block a specific IP Connecting to a server with firewall-cmd
  6. Shopt: Not Found [No Such File Or Directory]
  7. How to Make User Account Read-Only in CentOS/RHEL 7
  8. CentOS / RHEL 5 : How to use the faillog command to track failed login attempts
  9. How to Configure Automatic Package Updates on the Server in CentOS/RHEL 8
  10. How to Disable Ctrl+c or Ctrl+z Using the “trap” Command in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found
  • macof: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright