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 -d|--no-datasum
93 disable data checksum calculations and set the NODATASUM file flag,
94 this can speed up the conversion
95
96 -i|--no-xattr
97 ignore xattrs and ACLs of files
98
99 -n|--no-inline
100 disable inlining of small files to metadata blocks, this will
101 decrease the metadata consumption and may help to convert a
102 filesystem with low free space
103
104 -N|--nodesize <SIZE>
105 set filesystem nodesize, the tree block size in which btrfs stores
106 its metadata. The default value is 16KB (16384) or the page size,
107 whichever is bigger. Must be a multiple of the sectorsize, but not
108 larger than 65536. See mkfs.btrfs(8) for more details.
109
110 -r|--rollback
111 rollback to the original ext2/3/4 filesystem if possible
112
113 -l|--label <LABEL>
114 set filesystem label during conversion
115
116 -L|--copy-label
117 use label from the converted filesystem
118
119 -O|--features <feature1>[,<feature2>...]
120 A list of filesystem features enabled the at time of conversion.
121 Not all features are supported by old kernels. To disable a
122 feature, prefix it with ^. Description of the features is in
123 section FILESYSTEM FEATURES of mkfs.btrfs(8).
124
125 To see all available features that btrfs-convert supports run:
126
127 btrfs-convert -O list-all
128
129 -p|--progress
130 show progress of conversion (a heartbeat indicator and number of
131 inodes processed), on by default
132
133 --no-progress
134 disable progress and show only the main phases of conversion
135
137 btrfs-convert will return 0 if no error happened. If any problems
138 happened, 1 will be returned.
139
141 mkfs.btrfs(8)
142
143
144
145Btrfs v5.1 05/17/2019 BTRFS-CONVERT(8)