Introduction to btrfs-progs

The btrfs-progs package contains administration and debugging tools for the B-tree file system (btrfs).

This package is known to build and work properly using an LFS-10.1 platform.

Package Information

Btrfs-progs Dependencies





LVM2-2.03.11 (dmsetup is used in tests) and reiserfsprogs-3.6.27 (for tests)

User Notes:

Kernel Configuration

Enable the following option in the kernel configuration and recompile the kernel:

File systems --->
  <*/M> Btrfs filesystem support [CONFIG_BTRFS_FS]

In addition to the above and to the options required for LVM2-2.03.11 and reiserfsprogs-3.6.27, the following options must be enabled for running tests:

File systems  --->
  [*]   Btrfs POSIX Access Control Lists      [CONFIG_BTRFS_FS_POSIX_ACL]
  [*]   ReiserFS extended attributes          [CONFIG_REISERFS_FS_XATTR]
  [*]     ReiserFS POSIX Access Control Lists [CONFIG_REISERFS_FS_POSIX_ACL]

Installation of btrfs-progs

Install btrfs-progs by running the following commands:

./configure --prefix=/usr \
            --bindir=/bin \
            --libdir=/lib \
            --with-pkgconfigdir=/usr/lib/pkgconfig &&


Some tests require grep built with perl regular expressions. To obtain this, rebuild grep with the LFS Chapter 8 instructions after installing PCRE-8.44.

To test the results, first disable one test that fails and prevents the other ones to run:

mv tests/fsck-tests/012-leaf-corruption/{,.broken}

To test the results, run (as the root user):

make -j1 -k test


If the above mentioned kernel options are not enabled, some tests fail, and prevent all the remaining tests to run, because the test disk image is not cleanly unmounted.

Two tests fail for unknown reasons in the test-libbtrfsutil section. Tests take a very long time, and it may be interesting to run only part of them. Running tests only in one directory can be done with make TEST=<DIR> test.

Install the package as the root user:

make install &&

ln -sfv ../../lib/$(readlink /lib/ /usr/lib/ &&
ln -sfv ../../lib/$(readlink /lib/ /usr/lib/ &&
rm -fv /lib/libbtrfs.{a,so} /lib/libbtrfsutil.{a,so} &&
mv -v /bin/{mkfs,fsck}.btrfs /sbin

Command Explanations

--disable-documentation: This option is needed if the recommended dependencies are not installed.

ln -s ... /usr/lib/ Creates a symbolic link in the directory where it is expected.

rm /lib/libbtrfs.{a,so}: Removes unneeded library entries.


Installed Programs: btrfs, btrfs-convert, btrfs-find-root, btrfs-image, btrfs-map-logical, btrfs-select-super, btrfsck (link to btrfs), btrfstune, fsck.btrfs, and mkfs.btrfs
Installed Libraries: and
Installed Directories: /usr/include/btrfs

Short Descriptions


is the main interface into btrfs filesystem operations


converts from an ext2/3/4 or reiserfs filesystem to btrfs


is a filter to find btrfs root


maps btrfs logical extent to physical extent


overwrites the primary superblock with a backup copy


tunes various filesystem parameters


does nothing, but is present for consistency with fstab


creates a btrfs file system

Last updated on 2021-03-26 13:25:31 -0500