LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Why my initrd.gz is getting bigger? (http://www.linuxquestions.org/questions/slackware-14/why-my-initrd-gz-is-getting-bigger-4175474042/)

PreguntoYo 08-20-2013 01:58 PM

Why my initrd.gz is getting bigger?
 
Hello:

I'm using Slackware 14.0 stable, with LVM under LUKS, spanish keymap, hibernation... and today I wanted to experiment with mkinitrd. I wanted to make an initrd as small as posible; I tried:

Code:

mkinitrd -c -k 3.2.45-smp -f ext4 -r /dev/GV_Slack/root -m mbcache:jbd2:ext4 -C /dev/sda2 -L -u -o /boot/initrd.gz -l es -h /dev/GV_Slack/swap
...as suggested by mkinitrd_command_generator.sh, but as it outputs:

Code:

OK: /lib/modules/3.2.45-smp/kernel/fs/mbcache.ko added.
OK: /lib/modules/3.2.45-smp/kernel/fs/jbd2/jbd2.ko added.
OK: /lib/modules/3.2.45-smp/kernel/fs/mbcache.ko added.
OK: /lib/modules/3.2.45-smp/kernel/fs/jbd2/jbd2.ko added.
OK: /lib/modules/3.2.45-smp/kernel/fs/ext4/ext4.ko added.
21995 blocks
/boot/initrd.gz created.
Be sure to run lilo again if you use it.

I had always been in doubt if mbcache.ko and jbd2.ko had been included twice in initrd.gz, and if I could make it smaller with just:

Code:

mkinitrd -c -k 3.2.45-smp -f ext4 -r /dev/GV_Slack/root -m ext4 -C /dev/sda2 -L -u -o /boot/initrd.gz -l es -h /dev/GV_Slack/swap
Which outputs:

Code:

OK: /lib/modules/3.2.45-smp/kernel/fs/mbcache.ko added.
OK: /lib/modules/3.2.45-smp/kernel/fs/jbd2/jbd2.ko added.
OK: /lib/modules/3.2.45-smp/kernel/fs/ext4/ext4.ko added.
21995 blocks
/boot/initrd.gz created.
Be sure to run lilo again if you use it.

Notice it "pulls" mbcache.ko and jbd2.ko (really, I don't know why would I need those two modules, anyway). I thought the initrd.gz would be smaller, but everytime I use it, the file gets bigger!:

Code:

ls -l /boot

-rw-r--r--  1 root root 4640826 ago 20 20:15 initrd.gz
-rw-r--r--  1 root root 4640876 ago 20 20:20 initrd02.gz
-rw-r--r--  1 root root 4641289 ago 20 20:22 initrd03.gz
-rw-r--r--  1 root root 4641324 ago 20 20:23 initrd04.gz

Am I doing something wrong?. Do I have some misconception about how mknitrd really works?. I'm puzzled.

Any ideas?.

ljb643 08-20-2013 03:24 PM

The 2 modules mbcache and jbd2 are dependencies of the ext4 filesystem module. You do not need to specify them separately with -m, as they will be added automatically. If you do put them in with -m, they are copied twice to the staging area (those "OK" messages), but with the same path, so the staging area and actual disk image only contain one copy of each. So there is no harm there in using -m.

I don't know why the image gets bigger each time - perhaps someone else does.

guanx 08-21-2013 10:47 AM

Quote:

Originally Posted by PreguntoYo (Post 5012650)
I had always been in doubt if mbcache.ko and jbd2.ko had been included twice in initrd.gz, and if I could make it smaller with just:
Code:

mkinitrd -c -k 3.2.45-smp -f ext4 -r /dev/GV_Slack/root -m ext4 -C /dev/sda2 -L -u -o /boot/initrd.gz -l es -h /dev/GV_Slack/swap

If in doublt, try it. I assure you it will not trigger the nuclear bomb.

Quote:

Originally Posted by PreguntoYo (Post 5012650)
Code:

ls -l /boot

-rw-r--r--  1 root root 4640826 ago 20 20:15 initrd.gz
-rw-r--r--  1 root root 4640876 ago 20 20:20 initrd02.gz
-rw-r--r--  1 root root 4641289 ago 20 20:22 initrd03.gz
-rw-r--r--  1 root root 4641324 ago 20 20:23 initrd04.gz

Am I doing something wrong?. Do I have some misconception about how mknitrd really works?. I'm puzzled.

Any ideas?.

That is the modules list file sit in the root directory of the initrd.


All times are GMT -5. The time now is 07:23 AM.