This is useful when you need to rebuild the initrd file for another computer system but are not sure which kernel modules it needs to boot. The command above will rebuild the initrd file with all of the currently installed Linux kernel modules and not just the ones required for booting. If you are rebuilding that file for a different computer, though, use the dracut command. The mkinitrd command can be used if you are re-building the initrd file on the same computer having boot issues. The Dracut command is a little more versatile, though. Both re-create the initrd ram-based file for the Linux bootloader. Well, it's common to use one computer to fix issues with another one, correct? That's when you'll use the Dracut command.īoth that mkinitrd and dracut commands achieve the same purpose. So, why would you need to know about this command? Technically the mkinitrd command is nothing more than a wrapper for the Dracut command. For example, the '-f' flag will work as expected with REHL but not CentOS. In CentOS, that flag lists the existing files instead. So, make sure to use the 'man' command for the mkinitrd command first and read through its documentation for your specific flavor of Linux. The '-f' flag tells the mkinitrd command to overwrite the existing initdrd ram file. However, this does not work the same for all Linux distributions. mkinitrd -f /boot/initrd-$(uname -r).img $(uname -r) For instance, in general, you will want to use the command followed by the flag to overwrite the existing initrd image followed by the name of both the old and new image.ĮG. It's highly suggested that you double-check the manual for the mkinitrd command for the Linux distribution you are using. For instance, let's say you updated the kernel and that update did not go well. You could boot Linux to a safe environment and rebuild the initrd ramdisk to target an older version of the Linux kernel that did work. Either way, if there are changes to the system that would affect how the Linux OS is booted, the ramdisk needs to know about it. The boot parameters of the Linux OS changed for some reason. This could be because you installed a new kernel or installed a new piece of hardware that requires the kernel or kernel modules to be rebuilt. There are a few reasons you would want to use the mkinitrd commands. The mkinitrd command rebuilds that ram-based file system for the bootloader. That's where the mkinitrd command is used. That mini ram-based file system is called the initrd or initramfs. It contains the basic kernel components and commands required to let the bootloader start using the startup commands. That file system is completely ram-based. When the Linux bootloader loads, it mounts and uses a mini filesystem. Without any of them, the Linux OS won't load properly, but in this section, we're going to look at the boot process specifically. New to Linux commands, here's a quickstart guide for you.īoth boot and startup commands are essential Linux boot commands. The startup commands are what the bootloader uses to start things like the Linux kernel and essential kernel modules. The boot commands are what the MBR calls to start the bootloader along with the appropriate files the boot loader needs to start Linux. Technically, there are boot commands and startup commands, though both are typically referred to as boot commands. Let's set a couple of things straight here. Mkinitrd: How To Create The Ramdisk That Linux Boots From Here are four essential Linux boot commands every sysadmin needs to know. Likewise, if you are brave enough to attempt to install a distribution like Gentoo or Arch from scratch, you'll need to configure the Linux bootloader by hand. Though the bootloader is typically configured at the time of installing Linux automatically, understanding the boot process will help systems administrators know how to recover from boot failures. Linux systems administrators need to understand how the Linux boot process works.
0 Comments
Leave a Reply. |