Change initrd size

  • Developer


    Often I make changes in the init.gz, usually in the /bin/fog script. But now I need add a few new libraries, and I can’t do it; because I don’t have free space.

    When I mount the init in one local directory, the size of the mount directory is 36MB, used 35 MB and only 937 KB of free space. I need add some new libraries, and I need 7 MB more. How can i add more space in the initrd?

  • Developer

    Auto-answer :)
    Source: [url][/url]

    what you want to do is create a new image, say existing one is initrd.img and we’ll call the new one init. To create an image with a max size of 50 megs

    dd if=/dev/zero of=/init bs=1M count=50
    mke2fs /init (answer yes to the question it asks)
    mount -o loop /init_old /mnt/img
    mount -o loop /init /mnt/img2
    cp -Rp /mnt/img/* /mnt/img2
    <now add whatever other files you want to /mnt/img2>
    umount /mnt/img
    umount /mnt/img2
    gzip init

    Now you have a new larger image as init. There are other ways to do it but this is by far the easiest/safest in my opinion (been doing it all day trying to install rhel as 2.1 to install on an unsupported SAS controller).