info > BTRFS-CONVERT

📛 NAME

btrfs-convert - convert from ext2/3/4 or reiserfs filesystem to btrfs in-place

🚀 Quick Reference

Use CaseCommandDescription
Convert ext2/3/4 to btrfsbtrfs-convert /dev/sdxConvert filesystem in-place, original saved in ext2_saved subvolume
Rollback to original ext2/3/4btrfs-convert -r /dev/sdxUndo conversion if rollback subvolume still exists
Defragment after conversionbtrfs filesystem defrag -v -r -f -t 32M /mnt/btrfsMake file extents more contiguous
Balance metadatabtrfs balance start -m /mnt/btrfsMerge small metadata block groups
Remove saved subvolumebtrfs subvolume delete /mnt/ext2_savedDisable rollback permanently

📋 SYNOPSIS

btrfs-convert [options] <device>

📖 DESCRIPTION

btrfs-convert is used to convert existing source filesystem image to a btrfs filesystem in-place. The original filesystem image is accessible in subvolume named like ext2_saved as file image.

Supported filesystems:

The list of supported source filesystem by a given binary is listed at the end of help (option --help).

⚠️ Warning If you are going to perform rollback to the original filesystem, you should not execute btrfs balance command on the converted filesystem. This will change the extent layout and make btrfs-convert unable to rollback.

The conversion utilizes free space of the original filesystem. The exact estimate of the required space cannot be foretold. The final btrfs metadata might occupy several gigabytes on a hundreds-gigabyte filesystem.

If the ability to rollback is no longer important, it is recommended to perform a few more steps to transition the btrfs filesystem to a more compact layout. This is because the conversion inherits the original data blocks' fragmentation, and also because the metadata blocks are bound to the original free space layout.

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

🧐 BEFORE YOU START

The source filesystem must be clean, eg. no journal to replay or 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.

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.

📂 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. The filesystem is usable but may be impacted by the fragmentation inherited from the original filesystem.

📈 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).

🏗️ 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.

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

# btrfs balance start -m /mnt/btrfs

⚙️ OPTIONS

🚪 Exit Codes

btrfs-convert will return 0 if no error happened. If any problems happened, 1 will be returned.

📚 SEE ALSO

mkfs.btrfs(8)

BTRFS-CONVERT
📛 NAME 🚀 Quick Reference 📋 SYNOPSIS 📖 DESCRIPTION
🧐 BEFORE YOU START 📂 REMOVE THE ORIGINAL FILESYSTEM METADATA 📈 MAKE FILE DATA MORE CONTIGUOUS 🏗️ ATTEMPT TO MAKE BTRFS METADATA MORE COMPACT
⚙️ OPTIONS 🚪 Exit Codes 📚 SEE ALSO

Generated by phpman v4.9.26-5-g7740029 Author: Che Dong Under GNU General Public License
2026-08-14 21:10 @2600:1f28:365:80b0:4d23:66fa:c2bb:7bae
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!