sonic-buildimage/files
Samuel Angebault 274e929f11
Reduce SONiC image filesystem size (#16948)
Why I did it
Running SONiC releases past 202012 has become really challenging on system with small storage devices (4GB).
Some of these devices can also be limited by only having 4GB of RAM which complicates mitigations.
The main contributor to these issues is the SONiC image growth.
Being able to reduce it by some decent amount should allow these systems to run SONiC longer.
It would also reduce some impacts related to space savings mitigations.

Work item tracking
Microsoft ADO (number only):
How I did it
Add a build option to reduce the image size.
The image reduction process is affecting the builds in 2 ways:

change some packages that are installed in the rootfs
apply a rootfs reduction script
The script itself will perform a few steps:

remove file duplication by leveraging hardlinks
under /usr/share/sonic since the symlinks under the device folder are lost during the build.
under /var/lib/docker since the files there will only be mounted ro
remove some extra files (man, docs, licenses, ...)
some image specific space reduction (only for aboot images currently)
The script can later be improved but for now it's reducing the rootfs size by ~30%.

How to verify it
Compare the size of an image with this option enabled and this option enabled.
Expect the fully extracted content to be ~30% less.

Which release branch to backport (provide reason below if selected)
This is a backport of #16729

Description for the changelog
Add build option to reduce final image size
2023-10-24 21:08:38 +08:00
..
Aboot Disable CPU C-States other than C1 (#16703) 2023-10-17 20:49:07 +08:00
apt [Build] set apt Acquire::Retries to 3 for bullseye (#12758) 2022-11-21 08:05:16 +08:00
build/versions [ci/build]: Upgrade SONiC package versions (#16964) 2023-10-21 23:04:00 +08:00
build_scripts During build time mask only those feature/services that are disabled excplicitly (#13283) 2023-01-07 02:36:37 +00:00
build_templates Reduce SONiC image filesystem size (#16948) 2023-10-24 21:08:38 +08:00
dhcp Assign the higher metric value for Ipv6 default route learnt via RA message (#16367) (#16429) 2023-09-03 22:16:46 +08:00
docker [dockerd] Force usage of cgo DNS resolver (#13649) 2023-02-14 08:57:19 +02:00
image_config Fix potentially not having any loopback address on lo interface (#16490) (#16628) 2023-09-21 20:40:21 +08:00
initramfs-tools [arm64][Nokia-7215-A1]Add support for Nokia-7215-A1 platform (#13795) 2023-05-18 14:24:05 -07:00
scripts [swss] Chassis db clean up optimization and bug fixes (#16454) (#16644) 2023-09-22 10:58:27 +08:00
sshd Remove SSH host keys after installing the custom version of sshd (#10633) 2022-04-25 10:38:52 -07:00