Btrfs/Statically built btrfs-progs
btrfs-progs[edit | edit source]
Using the latest version of btrfs-progs is essential for data recovery with tools like btrfs check and to avoid encountering bugs. However, when using a long-term support (LTS) release of a Linux distribution, it's possible that newer btrfs-progs may not be backported. For instance, as of the time of writing, Debian 11 only includes btrfs-progs-5.10.1, while the latest upstream version is btrfs-progs-6.7.1 .
Statically built btrfs-progs[edit | edit source]
If you can't install the latest btrfs-progs on your system, you can use a statically linked version instead. It has no additional runtime requirements other than the Linux kernel and doesn't need any special installation
Compiling from source[edit | edit source]
If you want to compile your own btrfs-progs from source, you can find build instructions are available at https://github.com/kdave/btrfs-progs/blob/master/INSTALL
It should be as simple a running the following:
./autogen.sh ./configure --disable-shared --disable-documentation --enable-experimental 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
--enable-experimental
is needed if you need to test new features, such as --csum
conversion.Prebuilt binaries[edit | edit source]
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 setup a GCC build environment for x86_64 and arm64 platforms.
- x86_64/AMD64 versions are built with
CFLAGS="-O2 -march=x86-64"
and should work on most 64 bit AMD and Intel systems. - arm64/aarch64 versions are built with
CFLAGS="-O2 -march=armv8-a"
and should work on 64 bit ARM v8 platforms.
- riscv64/lp64d versions are built with
CFLAGS="-O2 -march=rv64gc -mabi=lp64d"
and should work on 64 bit RISC-V platforms based on RV64GC instruction set.
I do not currently have Arm or RISC-V hardware at hand to test the binaries so they have only been tested in a VM under QEMU.
The binaries can downloaded from https://mirrors.tnonline.net/btrfs/btrfs-progs/
DISCLAIMER![edit | edit source]
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!
Since btrfs-progs v6.2
, statically built versions are directly provided from upstream on the official GitHub page.