Occassionally you may need to change the boot image (initrd) on your Linux boot drive. For example, you may need to add a driver that is required to get a minimal system running. In my case I required a RAID driver so the disks could be seen. This procedure is based on the RedHat distribution but should work for any distribution.

1. Copy the initrd image in /boot to a temporary place, e.g. cp /boot/initrd.img-3.13.0-37-generic /var/tmp/test
2. cd /var/tmp/test 
3. Uncompress the boot image to disk, cd mountpoint
     gzip -dc initrd.img-3.13.0-37-generic > initrd.tmp
4. The uncompressed file is actually a cpio image so you need to extract this , 
     cpio -idumv < initrd.tmp
5. You can now view the contents of initrd.tmp

    $ ls
    $ bin  conf  etc  init  initrd.tmp  lib  lib64  run  sbin  scripts  usr  var

6. Files can now be updated as required
7. Recreate the CPIO image, find . | cpio -ov > new-initrd.img
8. Compress the image, gzip -S new-initrd.img
9. cp new-initrd.img /boot/initrd.img-3.13.0-37-generic

NOTE This procedure supersedes the original article which can still be found in the archive area. The archived procedure may still need to be followed for older distros.

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