Btrfs/Statically built btrfs-progs

From Forza's ramblings
A rotary spark gap radio transmitter, a type of radio transmitter used during the wireless telegraphy era, circa 1900-1920.

Statically built btrfs-progs

It can be important to use the latest btrfs-progs when trying to recover data with btrfs check or avoid bugs, etc. However, if you are on a long-term support (LTS) release of a Linux distribution, it may be that newer btrfs progs are not backported at all. For example, Debian 10 (at this time of writing) only have btrfs-progs-5.10.1 while btrfs-progs-6.2.1 is the latest upstream version.

Compiling

If it is not possible to build the latest btrfs progs on your local system, you can build a btrfs progs statically linked binary on another system, and then copy the file over.

The build instructions are available at https://github.com/kdave/btrfs-progs/blob/master/INSTALL

./configure --disable-shared --disable-documentation
make static

The resulting files are

btrfs-convert.static
btrfs-corrupt-block.static
btrfs-find-root.static
btrfs-image.static
btrfs-map-logical.static
btrfs-select-super.static
btrfs.static
btrfsck.static
btrfstune.static
mkfs.btrfs.static

Prebuilt binaries

One caveat is that compiling btrfs-progs statically also needs external libraries also statically built (e2fsprogs, libuuid, libzstd, libgzip, etc...). This may not be possible without a dedicated build-environment.

To make it easier, I have made statically built binaries available. These are built with CFLAGS="-O2 -march=x86-64" and should work on most 64bit AMD and Intel systems.

https://mirrors.tnonline.net/?dir=btrfs/btrfs-progs

sha256sum
7f3a97c3ac78bac2d12a20cdc5dfea1e7a786d1583fefdb60ee5a056b7eb87b1  btrfs-progs-6.2.1-static.tar.bz2
704685f6fa3fb6d55f908f672a8391dcfa38ba973289d63025a85b95b905b74e  btrfs-progs-6.2.1-static.tar.gz
36c7d4e2fee4a2bd1c0ef7ea2be2545d5de1cf9d059cc680bd0e6f09518a73bb  btrfs-progs-6.2.1-static.tar.xz
201d2a20a200f8795abe22e5659d7014c0bd532e7c6cc55de2d59dab8ddd7538  btrfs-progs-6.2.1-static.tar.zst

DISCLAIMER!

These binaries are not officially supported!

I provide these pre-built binaries as-is with NO WARRANTY. Although I have tested these on my own system, there are no guarantees they work on any other system. They may be broken, cause data corruption, or other severe issues. Always use officially provided btrfs-progs from your Linux distribution when in doubt!