[linux-lvm] Reducing size of user space lvm binary

Urs Thuermann urs at isnogud.escape.de
Mon Mar 20 10:39:03 UTC 2006


I am currently converting from LVM1 to DM + LVM2.  I have my root fs
on LVM so I need to load the kernel modules and scan for VGs in initrd
before mounting the real root device.

With LVM1, I had copied liblvm-10.so, vgscan and vgchange to my initrd
file system.  With LVM2, everything is in one large binary, which
consumes considerably more space on my initrd, which I'd like to
reduce.

I changed tools/commands.h to only contain vgscan and vgchange, and
then relinked the lvm binary with

    gcc -s -o lvm lvm.o lvmcmdline.o vgchange.o vgscan.o vgmknodes.o \
        pvmove.o toollib.o polldaemon.o -Wl,--export-dynamic         \
        -L../lib -L/lib -llvm -ldevmapper -ldl  -rdynamic

The size is still 300 kB.  Is there a way to further reduce its size?

Is vgscan required in the initrd?  The man page for vgscan says that
in LVM2, vgscans take place automatically.  What does this mean?  When
is the scan done automatically?  Is it done as part of other commands
like vgchange?

urs




More information about the linux-lvm mailing list