From kernel 2.6 initrd was deprecated and initramfs was introduced instead. initramfs differs from initrd in that when it's loaded by the kernel at boot time, a cpio archive is read into memory via tmpfs rather than containing a filesystem like initrd (our archived article from a log time ago explains how to dissect initrd ). The reason for this is to make initramfs more flexible, efficient and simpler.

Instead of mkinitrd, the dracut command is used to generate a new initramfs file. e.g.

 cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak # backup the current image!
 dracut -f

The dracut command will build initramfs based on the current kernel. To build from a different kernel specify it on the command line

 dracut -f initramfs-2.6.32-642.13.1.el6.x86_64.img 2.6.32-642.13.1.el6.x86_64

Here's the results.

  1. rw——- 1 root root 20859884 Feb 7 07:35 initramfs-2.6.32-504.3.3.el6.x86_64.img
  2. rw——- 1 root root 22567250 Feb 7 09:54 initramfs-2.6.32-642.13.1.el6.x86_64.img
  3. rw——- 1 root root 6295430 Feb 7 07:21 initrd-2.6.32-504.3.3.el6.x86_64kdump.img
  4. rw——- 1 root root 5801224 Feb 7 10:32 initrd-2.6.32-642.13.1.el6.x86_64kdump.img

But wait a minute, there's still an intrd file? That is actually used by kdump and is much smaller than the initramfs file as can be seen. If you have kdump enabled, you'll see this file. In the event of a kernel crash, kdump preserves system consistency by booting another Linux kernel, which is known as the dump-capture kernel and using it to save a memory dump. The dump can then be analysed to determine the cause of the crash. When this second kernel is booted the initrd file will be used. If the initrd file needs updating, restarting the kdump process will result in a new initrd file being generated.

 root> #service kdump restart
 Stopping kdump:                                            [  OK  ]
 Detected change(s) the following file(s):
 
   /etc/kdump.conf
 Rebuilding /boot/initrd-2.6.32-642.13.1.el6.x86_64kdump.img
 Warning: There might not be enough space to save a vmcore.
          The size of UUID=788583bc-05bc-4fc3-89da-e62967933a6e should be greater than 32746856 kilo bytes.
 Starting kdump:                                            [  OK  ]
 root>

Why this initrd hasn't transitioned to initramfs too is unknown to me but I expect there's a good reason.

NOTE: The above is based on RHEL. Other distros, e.g ubuntu, although using the initramfs format, retained the initrd name. Ubuntu also usesa different command for generating the images, update-initramfs

Recent Changes

Contribute to this wiki

Why not help others by sharing your knowledge? Contribute something to this wiki and join out hall of fame!
Contact us for a user name and password