150 MB Minimal FreeBSD Installation
This technical deep dive explores the challenging quest to shrink a FreeBSD installation to a mere 150 MB, pushing the limits of system minimalism. It meticulously details the process of pruning packages, locking critical dependencies, and even modifying the package manager's database to achieve an ultralight footprint. The story appeals to Hacker News's appreciation for low-level system optimization and the pursuit of efficiency, even if the practical gains are debatable in an era of abundant storage.
The Lowdown
Inspired by a social media query, this article documents a daring experiment to significantly reduce the size of a FreeBSD 15.0-RELEASE installation using the pkgbase system. While a standard minimal installation clocks in at 450 MB, the author's goal was to push it down to an impressive 150 MB.
- The process begins with a base FreeBSD 15.0-RELEASE installation, leveraging ZFS with
zstd-19compression and selecting only thebasesystem component. - To prevent critical system packages from being accidentally removed, essential components like
FreeBSD-libarchive,FreeBSD-openssl-lib,FreeBSD-xz-lib,FreeBSD-libucl, andFreeBSD-libcasperare explicitly 'locked' usingpkg lock. - The core reduction involves forcefully deleting entire package sets, specifically
FreeBSD-set-develandFreeBSD-set-optional, to shed unnecessary binaries and libraries. - A significant hurdle is then addressed: the
pkg upgradecommand's tendency to reinstall these removed packages. This is overcome by directly manipulating thepkgSQLite database, deleting thebase/FreeBSD-set-develdependency frombase/FreeBSD-set-base. - The result is a functional FreeBSD system using approximately 150 MB of disk space, demonstrating extreme resource parsimony.
- The author further identifies opportunities to reduce the footprint below 100 MB by removing large, unused kernel modules and potentially parts of the
pkg-staticbinary.
While acknowledging that such extreme disk space savings may not be paramount in today's computing landscape, the article serves as a testament to the granular control and optimization possible within the FreeBSD ecosystem, even if the resulting setup is unsupported and primarily for testing.