6 btrfs-convert - convert from ext2/3/4 or reiserfs filesystem to btrfs in-place
10 *btrfs-convert* [options] <device>
14 *btrfs-convert* is used to convert existing source filesystem image to a btrfs
15 filesystem in-place. The original filesystem image is accessible in subvolume
16 named like 'ext2_saved' as file 'image'.
18 Supported filesystems:
20 * ext2, ext3, ext4 -- original feature, always built in
22 * reiserfs -- since version 4.13, optionally built, requires libreiserfscore 3.6.27
24 The list of supported source filesystem by a given binary is listed at the end
25 of help (option '--help').
27 WARNING: If you are going to perform rollback to the original filesystem, you
28 should not execute *btrfs balance* command on the converted filesystem. This
29 will change the extent layout and make *btrfs-convert* unable to rollback.
31 The conversion utilizes free space of the original filesystem. The exact
32 estimate of the required space cannot be foretold. The final btrfs metadata
33 might occupy several gigabytes on a hundreds-gigabyte filesystem.
35 If the ability to rollback is no longer important, the it is recommended to
36 perform a few more steps to transition the btrfs filesystem to a more compact
37 layout. This is because the conversion inherits the original data blocks'
38 fragmentation, and also because the metadata blocks are bound to the original
41 Due to different constraints, it is only possible to convert filesystems that
42 have a supported data block size (ie. the same that would be valid for
43 'mkfs.btrfs'). This is typically the system page size (4KiB on x86_64
46 NOTE: The source filesystem should be clean, you are encouraged to run the
47 'fsck' tool if you're not sure.
49 **REMOVE THE ORIGINAL FILESYSTEM METADATA**
51 By removing the subvolume named like 'ext2_saved' or 'reiserfs_saved', all
52 metadata of the original filesystem will be removed:
54 # btrfs subvolume delete /mnt/ext2_saved
56 At this point it is not possible to do a rollback. The filesystem is usable but
57 may be impacted by the fragmentation inherited from the original filesystem.
59 **MAKE FILE DATA MORE CONTIGUOUS**
61 An optional but recommended step is to run defragmentation on the entire
62 filesystem. This will attempt to make file extents more contiguous.
64 # btrfs filesystem defrag -v -r -f -t 32M /mnt/btrfs
66 Verbose recursive defragmentation ('-v', '-r'), flush data per-file ('-f') with
67 target extent size 32MiB ('-t').
69 **ATTEMPT TO MAKE BTRFS METADATA MORE COMPACT**
71 Optional but recommended step.
73 The metadata block groups after conversion may be smaller than the default size
74 (256MiB or 1GiB). Running a balance will attempt to merge the block groups.
75 This depends on the free space layout (and fragmentation) and may fail due to
76 lack of enough work space. This is a soft error leaving the filesystem usable
77 but the block group layout may remain unchanged.
79 Note that balance operation takes a lot of time, please see also
82 # btrfs balance start -m /mnt/btrfs
87 disable data checksum calculations and set the NODATASUM file flag, this can speed
90 ignore xattrs and ACLs of files
92 disable inlining of small files to metadata blocks, this will decrease the metadata
93 consumption and may help to convert a filesystem with low free space
94 -N|--nodesize <SIZE>::
95 set filesystem nodesize, the tree block size in which btrfs stores its metadata.
96 The default value is 16KB (16384) or the page size, whichever is bigger.
97 Must be a multiple of the sectorsize, but not larger than 65536. See
98 `mkfs.btrfs`(8) for more details.
100 rollback to the original ext2/3/4 filesystem if possible
102 set filesystem label during conversion
104 use label from the converted filesystem
105 -O|--features <feature1>[,<feature2>...]::
106 A list of filesystem features enabled the at time of conversion. Not all features
107 are supported by old kernels. To disable a feature, prefix it with '^'.
108 Description of the features is in section 'FILESYSTEM FEATURES' of
111 To see all available features that btrfs-convert supports run:
113 +btrfs-convert -O list-all+
116 show progress of conversion (a heartbeat indicator and number of inodes
117 processed), on by default
119 disable progress and show only the main phases of conversion
123 *btrfs-convert* will return 0 if no error happened.
124 If any problems happened, 1 will be returned.