HOWTO Rebuild an Initrd Image

Introduction

This document describes how to rebuild an initrd image file on a Debian 4.0 (Etch) system.

This can be necessary, if for example you restore your system to a different RAID or LVM setup, where the volume IDs may have changed. (Note that you will no doubt need to modify /etc/lvm/lvm.conf and /etc/mdadm/mdadm.conf to use the new volume IDs).

Note: If you are using Debian 6.0 (Squeeze) and probably the case with Debian 5.0 (Lenny), you should now use the update-initramfs utility, otherwise the tools that manage upgrading the kernel will fail with errors and require manual completion. Typically, to update an existing image:

# update-initramfs -u

man update-initramfs for more information.

-- Frank Dean - 22 Dec 2011

Rebuilding Initrd Image

Where you've booted off a rescue disk and mounted your normal root and boot partitions under say, /mnt/bak, you can rebuild an initrd image with the following:

# mkinitramfs -d /mnt/bak/etc/initramfs-tools -o /mnt/bak/boot/new.img -r /mnt/bak

You can then add another 'test' entry to your grub configuration file (/mnt/bak/boot/grub/menu.lst) to use new.img intead of the standard initrd image file. If it boots into your system successfully, just re-create the standard initrd image with:

# mkinitramfs -o /boot/initrd.img-2.6.18-6-686

Which should create an image configured identically to the way a new one is created on a kernel upgrade.

See also 'man update-initramfs'


-- Frank Dean - 03 Jan 2009

Related Topics: LinuxSoftwareRaid, LogicalVolumeManagement