BTRFS-CONVERT(8)

πŸ¦‹ NAME πŸ¦‹

okay so bestie, meet btrfs-convert β€” she takes your ext2/3/4 or reiserfs filesystem and turns it into btrfs in-place. No reformat, no copy, no drama. Literally a glow-up for your disk. πŸ’…βœ¨


🌸 SYNOPSIS 🌸

btrfs-convert [options] <device>

✨ DESCRIPTION ✨

The btrfs-convert tool converts an existing source filesystem image into a btrfs filesystem, in-place. Your original filesystem image isn't gone forever either β€” it stays accessible in a subvolume named like ext2_saved, as a file image. It's giving "kept the receipt in case we need to return this". πŸ§ΎπŸ’–

Supported filesystems

  • ext2, ext3, ext4 β€” the original feature, and always built in. OGs never leave. πŸ‘‘
  • reiserfs β€” since version 4.13, optionally built, requires libreiserfscore 3.6.27
  • NTFS β€” external tool: https://github.com/maharmstone/ntfs2btrfs

The list of supported source filesystem by a given binary is listed at the end of help (option --help). So if you're ever questioning what your build can actually do, just ask her nicely. 🫢

⚠️ Warning: if you are going to perform rollback to the original filesystem, you should not execute btrfs balance command on the converted filesystem. That will change the extent layout and make btrfs-convert unable to rollback. Like, it will genuinely break the undo button. Do not. 😭

The conversion utilizes free space of the original filesystem. The exact estimate of the required space cannot be foretold β€” no fortune teller, no crystal ball, we simply do not know. The final btrfs metadata might occupy several gigabytes on a hundreds-gigabyte filesystem. Several. Gigabytes. On a hundred-gigabyte disk. That's the vibe. πŸ“

If the ability to rollback is no longer important, then it is recommended to perform a few more steps to transition the btrfs filesystem to a more compact layout. Why? Because the conversion inherits the original data blocks' fragmentation, and also because the metadata blocks are bound to the original free space layout. Basically she moved in and kept all your old furniture arrangement. πŸ›‹οΈ

Due to different constraints, it is only possible to convert filesystems that have a supported data block size (i.e. the same that would be valid for mkfs.btrfs). This is typically the system page size (4KiB on x86_64 machines).

πŸ“Œ Note: always consider if a mkfs and file copy would not be a better option than the in-place conversion given what was said above. The conversion depends on 3rd party libraries and the other filesystems could still evolve and add new features. Not all combinations are covered or tested. She's talented, not omniscient. πŸ™ˆ

🌈 BEFORE YOU START 🌈

The source filesystem must be clean β€” e.g. no journal to replay, no repairs needed. The respective fsck utility must be run on the source filesystem prior to conversion. Please refer to the manual pages in case you encounter problems. Vibe check your disk before you invite btrfs in. 🧼

For ext2/3/4:

# e2fsck -fvy /dev/sdx

For reiserfs:

# reiserfsck -fy /dev/sdx

Skipping that step could lead to incorrect results on the target filesystem, but it may work. "May work" is doing an enormous amount of heavy lifting in that sentence, bestie. 😬

πŸŽ€ REMOVE THE ORIGINAL FILESYSTEM METADATA πŸŽ€

By removing the subvolume named like ext2_saved or reiserfs_saved, all metadata of the original filesystem will be removed:

# btrfs subvolume delete /mnt/ext2_saved

At this point it is not possible to do a rollback. Periodt. The filesystem is usable but may be impacted by the fragmentation inherited from the original filesystem. This is the point of no return and she's not coming back. πŸ’€

πŸ¦‹ MAKE FILE DATA MORE CONTIGUOUS πŸ¦‹

An optional but recommended step is to run defragmentation on the entire filesystem. This will attempt to make file extents more contiguous. ✨

# btrfs filesystem defrag -v -r -f -t 32M /mnt/btrfs

Verbose recursive defragmentation (-v, -r), flush data per-file (-f) with target extent size 32MiB (-t). Yes that's four flags, no she's not extra, she's thorough. πŸ’…

⭐ ATTEMPT TO MAKE BTRFS METADATA MORE COMPACT ⭐

Optional but recommended step.

The metadata block groups after conversion may be smaller than the default size (256MiB or 1GiB). Running a balance will attempt to merge the block groups. This depends on the free space layout (and fragmentation) and may fail due to lack of enough work space. This is a soft error leaving the filesystem usable but the block group layout may remain unchanged. So if it fails, it's fine, she just shrugged. πŸ€·β€β™€οΈ

Note that balance operation takes a lot of time β€” please see also btrfs-balance(8).

# btrfs balance start -m /mnt/btrfs

πŸ’– OPTIONS πŸ’–

  • --csum <type>, --checksum <type> β€” specify the checksum algorithm. Default is crc32c. Valid values are crc32c, xxhash, sha256 or blake2. To mount such filesystem, kernel must support the checksums as well. So pick one your kernel can actually read, mkay? 🫢
  • -d, --no-datasum β€” disable data checksum calculations and set the NODATASUM file flag. This can speed up the conversion. Speeeeed. πŸ”₯
  • -i, --no-xattr β€” ignore xattrs and ACLs of files. Just straight up not looking at them. πŸ™ˆ
  • -n, --no-inline β€” disable inlining of small files to metadata blocks. This will decrease the metadata consumption and may help to convert a filesystem with low free space. Low on space? This is your girl.
  • -N, --nodesize <SIZE> β€” set filesystem nodesize, the tree block size in which btrfs stores its metadata. The default value is 16KiB (16384) or the page size, whichever is bigger. Must be a multiple of the sectorsize, but not larger than 65536. See mkfs.btrfs(8) for more details.
  • -r, --rollback β€” rollback to the original ext2/3/4 filesystem if possible. The undo button, if you earned it. ↩️
  • -l, --label <LABEL> β€” set filesystem label during conversion.
  • -L, --copy-label β€” use label from the converted filesystem.
  • -O, --features <feature1>[,<feature2>...] β€” a list of filesystem features enabled at the time of conversion. Not all features are supported by old kernels. To disable a feature, prefix it with ^. Description of the features is in section FILESYSTEM FEATURES of mkfs.btrfs(8).

To see all available features that btrfs-convert supports run:

btrfs-convert -O list-all
  • -p, --progress β€” show progress of conversion (a heartbeat indicator and number of inodes processed). On by default. She wants you to watch her work. πŸ’…
  • --no-progress β€” disable progress and show only the main phases of conversion.
  • --uuid <SPEC> β€” set the FSID of the new filesystem based on 'SPEC':
    • new β€” (default) generate UUID for the FSID of btrfs
    • copy β€” copy UUID from the source filesystem
    • UUID β€” a conforming UUID value, the 36 byte string representation
  • --version β€” print the btrfs-convert version, builtin features and exit. Quick little "who am I" moment. πŸ‘‘

🌟 EXIT STATUS 🌟

btrfs-convert will return 0 if no error happened. If any problems happened, 1 will be returned. Simple as. Clean girl = 0, chaotic girl = 1. ✨


πŸ‘€ SEE ALSO πŸ‘€

mkfs.btrfs(8)


and that's the whole page, bestie β€” btrfs-convert from the btrfs collection, version 7.3, dated Oct 24, 2026. go forth and convert responsibly, and remember: fsck first, always. mwah πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from