1BTRFS-CONVERT(8) Btrfs Manual BTRFS-CONVERT(8)
2
3
4
6 btrfs-convert - convert from ext2/3/4 or reiserfs filesystem to btrfs
7 in-place
8
10 btrfs-convert [options] <device>
11
13 btrfs-convert is used to convert existing source filesystem image to a
14 btrfs filesystem in-place. The original filesystem image is accessible
15 in subvolume named like ext2_saved as file image.
16
17 Supported filesystems:
18
19 · ext2, ext3, ext4 — original feature, always built in
20
21 · reiserfs — since version 4.13, optionally built, requires
22 libreiserfscore 3.6.27
23
24 The list of supported source filesystem by a given binary is listed at
25 the end of help (option --help).
26
27 Warning
28 If you are going to perform rollback to the original filesystem,
29 you should not execute btrfs balance command on the converted
30 filesystem. This will change the extent layout and make
31 btrfs-convert unable to rollback.
32
33 The conversion utilizes free space of the original filesystem. The
34 exact estimate of the required space cannot be foretold. The final
35 btrfs metadata might occupy several gigabytes on a hundreds-gigabyte
36 filesystem.
37
38 If the ability to rollback is no longer important, the it is
39 recommended to perform a few more steps to transition the btrfs
40 filesystem to a more compact layout. This is because the conversion
41 inherits the original data blocks' fragmentation, and also because the
42 metadata blocks are bound to the original free space layout.
43
44 Due to different constraints, it is only possible to convert
45 filesystems that have a supported data block size (ie. the same that
46 would be valid for mkfs.btrfs). This is typically the system page size
47 (4KiB on x86_64 machines).
48
49 Note
50 The source filesystem should be clean, you are encouraged to run
51 the fsck tool if you’re not sure.
52
53 REMOVE THE ORIGINAL FILESYSTEM METADATA
54
55 By removing the subvolume named like ext2_saved or reiserfs_saved, all
56 metadata of the original filesystem will be removed:
57
58 # btrfs subvolume delete /mnt/ext2_saved
59
60 At this point it is not possible to do a rollback. The filesystem is
61 usable but may be impacted by the fragmentation inherited from the
62 original filesystem.
63
64 MAKE FILE DATA MORE CONTIGUOUS
65
66 An optional but recommended step is to run defragmentation on the
67 entire filesystem. This will attempt to make file extents more
68 contiguous.
69
70 # btrfs filesystem defrag -v -r -f -t 32M /mnt/btrfs
71
72 Verbose recursive defragmentation (-v, -r), flush data per-file (-f)
73 with target extent size 32MiB (-t).
74
75 ATTEMPT TO MAKE BTRFS METADATA MORE COMPACT
76
77 Optional but recommended step.
78
79 The metadata block groups after conversion may be smaller than the
80 default size (256MiB or 1GiB). Running a balance will attempt to merge
81 the block groups. This depends on the free space layout (and
82 fragmentation) and may fail due to lack of enough work space. This is a
83 soft error leaving the filesystem usable but the block group layout may
84 remain unchanged.
85
86 Note that balance operation takes a lot of time, please see also
87 btrfs-balance(8).
88
89 # btrfs balance start -m /mnt/btrfs
90
92 --csum <type>, --checksum <type>
93 Specify the checksum algorithm. Default is crc32c. Valid values are
94 crc32c, xxhash, sha256 or blake2. To mount such filesystem kernel
95 must support the checksums as well.
96
97 -d|--no-datasum
98 disable data checksum calculations and set the NODATASUM file flag,
99 this can speed up the conversion
100
101 -i|--no-xattr
102 ignore xattrs and ACLs of files
103
104 -n|--no-inline
105 disable inlining of small files to metadata blocks, this will
106 decrease the metadata consumption and may help to convert a
107 filesystem with low free space
108
109 -N|--nodesize <SIZE>
110 set filesystem nodesize, the tree block size in which btrfs stores
111 its metadata. The default value is 16KB (16384) or the page size,
112 whichever is bigger. Must be a multiple of the sectorsize, but not
113 larger than 65536. See mkfs.btrfs(8) for more details.
114
115 -r|--rollback
116 rollback to the original ext2/3/4 filesystem if possible
117
118 -l|--label <LABEL>
119 set filesystem label during conversion
120
121 -L|--copy-label
122 use label from the converted filesystem
123
124 -O|--features <feature1>[,<feature2>...]
125 A list of filesystem features enabled the at time of conversion.
126 Not all features are supported by old kernels. To disable a
127 feature, prefix it with ^. Description of the features is in
128 section FILESYSTEM FEATURES of mkfs.btrfs(8).
129
130 To see all available features that btrfs-convert supports run:
131
132 btrfs-convert -O list-all
133
134 -p|--progress
135 show progress of conversion (a heartbeat indicator and number of
136 inodes processed), on by default
137
138 --no-progress
139 disable progress and show only the main phases of conversion
140
142 btrfs-convert will return 0 if no error happened. If any problems
143 happened, 1 will be returned.
144
146 mkfs.btrfs(8)
147
148
149
150Btrfs v5.10 01/18/2021 BTRFS-CONVERT(8)