1BTRFS-CONVERT(8)                 Btrfs Manual                 BTRFS-CONVERT(8)
2
3
4

NAME

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

SYNOPSIS

10       btrfs-convert [options] <device>
11

DESCRIPTION

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       •   ntfs — external tool https://github.com/maharmstone/ntfs2btrfs
25
26       The list of supported source filesystem by a given binary is listed at
27       the end of help (option --help).
28
29           Warning
30           If you are going to perform rollback to the original filesystem,
31           you should not execute btrfs balance command on the converted
32           filesystem. This will change the extent layout and make
33           btrfs-convert unable to rollback.
34
35       The conversion utilizes free space of the original filesystem. The
36       exact estimate of the required space cannot be foretold. The final
37       btrfs metadata might occupy several gigabytes on a hundreds-gigabyte
38       filesystem.
39
40       If the ability to rollback is no longer important, the it is
41       recommended to perform a few more steps to transition the btrfs
42       filesystem to a more compact layout. This is because the conversion
43       inherits the original data blocks' fragmentation, and also because the
44       metadata blocks are bound to the original free space layout.
45
46       Due to different constraints, it is only possible to convert
47       filesystems that have a supported data block size (ie. the same that
48       would be valid for mkfs.btrfs). This is typically the system page size
49       (4KiB on x86_64 machines).
50
51       BEFORE YOU START
52
53       The source filesystem must be clean, eg. no journal to replay or no
54       repairs needed. The respective fsck utility must be run on the source
55       filesytem prior to conversion. Please refer to the manual pages in case
56       you encounter problems.
57
58       For ext2/3/4:
59
60           # e2fsck -fvy /dev/sdx
61
62       For reiserfs:
63
64           # reiserfsck -fy /dev/sdx
65
66       Skipping that step could lead to incorrect results on the target
67       filesystem, but it may work.
68
69       REMOVE THE ORIGINAL FILESYSTEM METADATA
70
71       By removing the subvolume named like ext2_saved or reiserfs_saved, all
72       metadata of the original filesystem will be removed:
73
74           # btrfs subvolume delete /mnt/ext2_saved
75
76       At this point it is not possible to do a rollback. The filesystem is
77       usable but may be impacted by the fragmentation inherited from the
78       original filesystem.
79
80       MAKE FILE DATA MORE CONTIGUOUS
81
82       An optional but recommended step is to run defragmentation on the
83       entire filesystem. This will attempt to make file extents more
84       contiguous.
85
86           # btrfs filesystem defrag -v -r -f -t 32M /mnt/btrfs
87
88       Verbose recursive defragmentation (-v, -r), flush data per-file (-f)
89       with target extent size 32MiB (-t).
90
91       ATTEMPT TO MAKE BTRFS METADATA MORE COMPACT
92
93       Optional but recommended step.
94
95       The metadata block groups after conversion may be smaller than the
96       default size (256MiB or 1GiB). Running a balance will attempt to merge
97       the block groups. This depends on the free space layout (and
98       fragmentation) and may fail due to lack of enough work space. This is a
99       soft error leaving the filesystem usable but the block group layout may
100       remain unchanged.
101
102       Note that balance operation takes a lot of time, please see also
103       btrfs-balance(8).
104
105           # btrfs balance start -m /mnt/btrfs
106

OPTIONS

108       --csum <type>, --checksum <type>
109           Specify the checksum algorithm. Default is crc32c. Valid values are
110           crc32c, xxhash, sha256 or blake2. To mount such filesystem kernel
111           must support the checksums as well.
112
113       -d|--no-datasum
114           disable data checksum calculations and set the NODATASUM file flag,
115           this can speed up the conversion
116
117       -i|--no-xattr
118           ignore xattrs and ACLs of files
119
120       -n|--no-inline
121           disable inlining of small files to metadata blocks, this will
122           decrease the metadata consumption and may help to convert a
123           filesystem with low free space
124
125       -N|--nodesize <SIZE>
126           set filesystem nodesize, the tree block size in which btrfs stores
127           its metadata. The default value is 16KB (16384) or the page size,
128           whichever is bigger. Must be a multiple of the sectorsize, but not
129           larger than 65536. See mkfs.btrfs(8) for more details.
130
131       -r|--rollback
132           rollback to the original ext2/3/4 filesystem if possible
133
134       -l|--label <LABEL>
135           set filesystem label during conversion
136
137       -L|--copy-label
138           use label from the converted filesystem
139
140       -O|--features <feature1>[,<feature2>...]
141           A list of filesystem features enabled the at time of conversion.
142           Not all features are supported by old kernels. To disable a
143           feature, prefix it with ^. Description of the features is in
144           section FILESYSTEM FEATURES of mkfs.btrfs(8).
145
146           To see all available features that btrfs-convert supports run:
147
148           btrfs-convert -O list-all
149
150       -p|--progress
151           show progress of conversion (a heartbeat indicator and number of
152           inodes processed), on by default
153
154       --no-progress
155           disable progress and show only the main phases of conversion
156
157       --uuid <SPEC>
158           set the FSID of the new filesystem based on SPEC:
159
160new - (default) generate UUID for the FSID of btrfs
161
162copy - copy UUID from the source filesystem
163
164UUID - a conforming UUID value, the 36 byte string
165               representation
166

EXIT STATUS

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

SEE ALSO

172       mkfs.btrfs(8)
173
174
175
176Btrfs v5.15.1                     11/22/2021                  BTRFS-CONVERT(8)
Impressum