sonic-buildimage/scripts
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
..
j2cli [dockers] label SONiC Docker with manifest (#5939) 2021-04-26 13:51:50 -07:00
build_debian_base_system.sh [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
build_kvm_image.sh [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
build_mirror_config.sh [Build] Change the default mirror version config file (#13786) 2023-02-14 14:59:38 +08:00
build-optimize-fs-size.py Reduce SONiC image filesystem size (#16948) 2023-10-24 21:08:38 +08:00
collect_build_version_files.sh [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
collect_docker_version_files.sh [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
collect_host_image_version_files.sh [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
convert-pfx-cert-format.sh Simplify the function to covert pfx certificate (#5086) 2020-08-01 20:07:20 +08:00
dbg_files.sh Create the src archive in target/ when INSTALL_DEBUG_TOOLS=y (#3323) 2019-08-28 09:29:48 -07:00
docker_version_control.sh [build] Fix issues found in reproducible build. (#10407) 2022-03-31 13:07:46 +08:00
efi-sign.sh Add Secure Boot Support (#12692) 2023-03-14 14:55:22 +02:00
generate_buildinfo_config.sh [Build] Support Debian snapshot mirror to improve build stability (#13097) 2023-01-13 16:16:35 +08:00
populate_file_web_server.py [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
prepare_debian_image_buildinfo.sh [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
prepare_docker_buildinfo.sh [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
prepare_slave_container_buildinfo.sh [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
process_log.sh [build]: add SONIC_CONFIG_BUILD_LOG_TIMESTAMP to add timestamp in build log (#4269) 2020-03-21 14:21:26 -07:00
run_with_retry Fix sonic-slave-* build errors about sudo command not found (#13412) 2023-01-31 12:35:17 +02:00
secure_boot_signature_verification.sh [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
sign_image_dev.sh Add support for secure upgrade (#11862) (#15691) 2023-07-19 16:08:14 +08:00
sign_image.sh [Secure Boot] Support to sign swi image (#4627) 2020-06-09 15:25:17 +08:00
signing_kernel_modules.sh [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
signing_secure_boot_dev.sh [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
versions_manager.py [CI][doc][build] Trim script and sonic-slave-* folders files trailing blanks (#15161) 2023-05-24 09:25:12 -07:00
wait_for_docker.sh [build]: wait up to 60 seconds for docker engine to start (#3067) 2019-06-22 14:40:05 -07:00