Package install size as installed through image builder vs. command line

Is there a rule of thumb for estimating the install size of a package as installed through an image building process based on the install size resulting from a regular command line install?

For example, I flashed my TP-Link C7 v5 with the downloaded sysupgrade bin, i.e.

openwrt-19.07.8-ath79-generic-tplink_archer-c7-v5-squashfs-sysupgrade.bin

installed just two things (kmod-usb-storage, kmod-fs-ext4), used df and got (in relevant portions):

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mtdblock9 11008 832 10176 8% /overlay

After that, I installed midnight commander (opkg install mc), did df, and got:

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mtdblock9 11008 3048 7960 28% /overlay

I believe that means midnight commander (with its dependencies) took up 3048 - 832, or 2216 KB.

If I am correct so far, what should be my estimate for midnight commander's install size as installed through image building, based on "regular" command line install 2216 KB?

Many devices are limited in storage capacity and there is no guarantee that the build system will detect when you have added too many packages to fit into the device storage space, which may render the device unbootable if installed. If in doubt, do not go overboard. Use what you had installed on the device last as a guide or create a minimal image first, install it to the device and test what you would like to add first.

1 Like

Most routers use squashfs for the rootfs, which makes it hard to estimate size on disk.

the ipk in itself can be viewed using mc, and the real size of the content can be seen inside.

1 Like

Image builder is using strong compression to reduce size. How well something is compressed depends from how it was made.
The only way to compare is to make an image with image builder with default packages, and then an image with default + your additional packages.
Then you know how much space the new packages you added will need.

In general, it's better to use Image Builder if you can do so, you use a lot less space if you install many packages

1 Like

I tallied the install sizes of certain packages (which I will list below). The result is:

  • As installed on command line, packages took up: 7,236 KB
  • As installed by inclusion in image building, they took up: 4,944 KB
  • The ratio is 4944 / 7236 = 0.68; meaning that inclusion in image building costs only 68% as of regular install or saves 32%.

The packages I used are these. Obviously your results may vary using another set of packages.

openssh-keygen openssh-server shadow-groupadd shadow-useradd shadow-usermod sudo kmod-usb-storage kmod-fs-ext4 block-mount gzip rsync nano cifsmount kmod-fs-cifs kmod-nls-utf8 mc ksmbd-server ksmbd-utils luci-app-ksmbd openssh-client e2fsprogs kmod-usb2 lsblk usbutils kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-fs-ntfs ntfs-3g kmod-wireguard luci-app-wireguard luci-proto-wireguard qrencode wireguard wireguard-tools

1 Like

Based on that package collection list, you probably meant "kilobytes" instead of "bytes". So that you packages tool 4.9 M instead of 7.2 MB...

2 Likes

Yes, exactly. Corrected. Thank you.