6 btrfs-convert - convert from ext2/3/4 filesystem to btrfs
10 *btrfs-convert* [options] <device>
14 *btrfs-convert* is used to convert existing ext2/3/4 filesystem image to a
15 btrfs filesystem in-place. The original filesystem image is accessible
16 subvolume named 'ext2_saved' as file 'image'.
18 WARNING: If you are going to perform rollback to ext2/3/4, you should not
19 execute *btrfs balance* command on the converted filesystem. This will change
20 the extent layout and make *btrfs-convert* unable to rollback.
22 The conversion utilizes free space of the original filesystem. The exact
23 estimate of the required space cannot be foretold. The final btrfs metadata
24 might occupy several gigabytes on a hundreds-gigabyte filesystem.
26 If you decide not to rollback anymore, it is recommended to perform a few more
27 steps to transform the btrfs filesystem to a more compact layout. The
28 conversion inherits the original data block fragmentation and the metadata
29 blocks are bound to the original free space layout.
31 **REMOVE THE ORIGINAL FILESYSTEM METADATA**
33 By removing the 'ext2_saved' subvolume, all metadata of the original filesystem
36 # btrfs subvolume delete /mnt/ext2_saved
38 At this point it's not possible to do rollback. The filesystem is usable but may
39 be impacted by the fragmentation.
41 **MAKE FILE DATA MORE CONTIGUOUS**
43 An optional but recommended step is to run defragmentation on the entire
44 filesystem. This will attempt to make file extents more contiguous.
46 # btrfs filesystem defrag -v -r -f -t 32M /mnt/btrfs
48 Verbose recursive defragmentation ('-v', '-r'), flush data per-file ('-f') with target
49 extent size 32M ('-t').
51 **ATTEMPT TO MAKE BTRFS METADATA MORE COMPACT**
53 Optional but recommended step.
55 The metadata block groups after conversion may be smaller than the default size
56 (256MiB or 1GiB). Running a balance will attempt to merge the block groups.
57 This depends on the free space layout (and fragmentation) and may fail. This is
58 a soft error leaving the filesystem usable but the block group layout may
61 Note that balance operation takes a lot of time.
63 # btrfs balance start -m /mnt/btrfs
68 disable data checksum calculations and set NODATASUM file flag, this can speed
71 ignore xattrs and ACLs of files
73 disable inlining of small files to metadata blocks, this will decrease the metadata
74 consumption and may help to convert a filesystem with low free space
75 -N|--nodesize <SIZE>::
76 set filesystem nodesize, the tree block size in which btrfs stores its metadata.
77 The default value is 16KB (16384) or the page size, whichever is bigger.
78 Must be a multiple of the sectorsize, but not larger than 65536. Se
79 `mkfs.btrfs`(8) for more details.
81 rollback to the original ext2/3/4 filesystem if possible
83 set filesystem label during conversion
85 use label from the converted filesystem
86 -O|--features <feature1>[,<feature2>...]::
87 A list of filesystem features turned on at btrfs-convert time. Not all features
88 are supported by old kernels. To disable a feature, prefix it with '^'.
90 To see all available features that btrfs-convert supports run:
92 +btrfs-convert -O list-all+
94 show progress of conversion, on by default
96 disable detailed progress and show only the main phases of conversion
100 *btrfs-convert* will return 0 if no error happened.
101 If any problems happened, 1 will be returned.