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       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       BEFORE YOU START
50
51       The source filesystem must be clean, eg. no journal to replay or no
52       repairs needed. The respective fsck utility must be run on the source
53       filesytem prior to conversion. Please refer to the manual pages in case
54       you encounter problems.
55
56       For ext2/3/4:
57
58           # e2fsck -fvy /dev/sdx
59
60       For reiserfs:
61
62           # reiserfsck -fy /dev/sdx
63
64       Skipping that step could lead to incorrect results on the target
65       filesystem, but it may work.
66
67       REMOVE THE ORIGINAL FILESYSTEM METADATA
68
69       By removing the subvolume named like ext2_saved or reiserfs_saved, all
70       metadata of the original filesystem will be removed:
71
72           # btrfs subvolume delete /mnt/ext2_saved
73
74       At this point it is not possible to do a rollback. The filesystem is
75       usable but may be impacted by the fragmentation inherited from the
76       original filesystem.
77
78       MAKE FILE DATA MORE CONTIGUOUS
79
80       An optional but recommended step is to run defragmentation on the
81       entire filesystem. This will attempt to make file extents more
82       contiguous.
83
84           # btrfs filesystem defrag -v -r -f -t 32M /mnt/btrfs
85
86       Verbose recursive defragmentation (-v, -r), flush data per-file (-f)
87       with target extent size 32MiB (-t).
88
89       ATTEMPT TO MAKE BTRFS METADATA MORE COMPACT
90
91       Optional but recommended step.
92
93       The metadata block groups after conversion may be smaller than the
94       default size (256MiB or 1GiB). Running a balance will attempt to merge
95       the block groups. This depends on the free space layout (and
96       fragmentation) and may fail due to lack of enough work space. This is a
97       soft error leaving the filesystem usable but the block group layout may
98       remain unchanged.
99
100       Note that balance operation takes a lot of time, please see also
101       btrfs-balance(8).
102
103           # btrfs balance start -m /mnt/btrfs
104

OPTIONS

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

EXIT STATUS

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

SEE ALSO

160       mkfs.btrfs(8)
161
162
163
164Btrfs v5.12.1                     05/13/2021                  BTRFS-CONVERT(8)
Impressum