Debian Codegraph @

upstream/debian-trixie/man8/btrfs-convert.8

raw
1 .\" Man page generated from reStructuredText.
2 .
3 .
4 .nr rst2man-indent-level 0
5 .
6 .de1 rstReportMargin
7 \\$1 \\n[an-margin]
8 level \\n[rst2man-indent-level]
9 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
10 -
11 \\n[rst2man-indent0]
12 \\n[rst2man-indent1]
13 \\n[rst2man-indent2]
14 ..
15 .de1 INDENT
16 .\" .rstReportMargin pre:
17 . RS \\$1
18 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
19 . nr rst2man-indent-level +1
20 .\" .rstReportMargin post:
21 ..
22 .de UNINDENT
23 . RE
24 .\" indent \\n[an-margin]
25 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
26 .nr rst2man-indent-level -1
27 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
28 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
29 ..
30 .TH "BTRFS-CONVERT" "8" "May 18, 2026" "7.0" "BTRFS"
31 .SH NAME
32 btrfs-convert \- convert from ext2/3/4 or reiserfs filesystem to btrfs in-place
33 .SH SYNOPSIS
34 .sp
35 \fBbtrfs\-convert\fP [options] <device>
36 .SH DESCRIPTION
37 .sp
38 The \fBbtrfs\-convert\fP tool can be used to convert existing source filesystem
39 image to a btrfs filesystem in\-place. The original filesystem image is
40 accessible in subvolume named like \fIext2_saved\fP as file \fIimage\fP\&.
41 .sp
42 Supported filesystems:
43 .INDENT 0.0
44 .IP \(bu 2
45 ext2, ext3, ext4 \-\- original feature, always built in
46 .IP \(bu 2
47 reiserfs \-\- since version 4.13, optionally built, requires libreiserfscore 3.6.27
48 .IP \(bu 2
49 NTFS \-\- external tool \X'tty: link https://github.com/maharmstone/ntfs2btrfs'\fI\%https://github.com/maharmstone/ntfs2btrfs\fP\X'tty: link'
50 .UNINDENT
51 .sp
52 The list of supported source filesystem by a given binary is listed at the end
53 of help (option \fI\-\-help\fP).
54 .sp
55 \fBWARNING:\fP
56 .INDENT 0.0
57 .INDENT 3.5
58 If you are going to perform rollback to the original filesystem, you
59 should not execute \fBbtrfs balance\fP command on the converted filesystem. This
60 will change the extent layout and make \fBbtrfs\-convert\fP unable to rollback.
61 .UNINDENT
62 .UNINDENT
63 .sp
64 The conversion utilizes free space of the original filesystem. The exact
65 estimate of the required space cannot be foretold. The final btrfs metadata
66 might occupy several gigabytes on a hundreds\-gigabyte filesystem.
67 .sp
68 If the ability to rollback is no longer important, the it is recommended to
69 perform a few more steps to transition the btrfs filesystem to a more compact
70 layout. This is because the conversion inherits the original data blocks\(aq
71 fragmentation, and also because the metadata blocks are bound to the original
72 free space layout.
73 .sp
74 Due to different constraints, it is only possible to convert filesystems that
75 have a supported data block size (i.e. the same that would be valid for
76 \fBmkfs.btrfs\fP). This is typically the system page size (4KiB on x86_64
77 machines).
78 .sp
79 \fBNOTE:\fP
80 .INDENT 0.0
81 .INDENT 3.5
82 Always consider if a mkfs and file copy would not be a better option than
83 the in\-place conversion given what was said above. The conversion depends on
84 3rd party libraries and the other filesystems could still evolve and add new
85 features. Not all combinations are covered or tested.
86 .UNINDENT
87 .UNINDENT
88 .sp
89 \fBBEFORE YOU START\fP
90 .sp
91 The source filesystem must be clean, e.g. no journal to replay or no repairs
92 needed. The respective \fBfsck\fP utility must be run on the source filesystem prior
93 to conversion. Please refer to the manual pages in case you encounter problems.
94 .sp
95 For ext2/3/4:
96 .INDENT 0.0
97 .INDENT 3.5
98 .sp
99 .EX
100 # e2fsck \-fvy /dev/sdx
101 .EE
102 .UNINDENT
103 .UNINDENT
104 .sp
105 For reiserfs:
106 .INDENT 0.0
107 .INDENT 3.5
108 .sp
109 .EX
110 # reiserfsck \-fy /dev/sdx
111 .EE
112 .UNINDENT
113 .UNINDENT
114 .sp
115 Skipping that step could lead to incorrect results on the target filesystem,
116 but it may work.
117 .sp
118 \fBREMOVE THE ORIGINAL FILESYSTEM METADATA\fP
119 .sp
120 By removing the subvolume named like \fIext2_saved\fP or \fIreiserfs_saved\fP, all
121 metadata of the original filesystem will be removed:
122 .INDENT 0.0
123 .INDENT 3.5
124 .sp
125 .EX
126 # btrfs subvolume delete /mnt/ext2_saved
127 .EE
128 .UNINDENT
129 .UNINDENT
130 .sp
131 At this point it is not possible to do a rollback. The filesystem is usable but
132 may be impacted by the fragmentation inherited from the original filesystem.
133 .sp
134 \fBMAKE FILE DATA MORE CONTIGUOUS\fP
135 .sp
136 An optional but recommended step is to run defragmentation on the entire
137 filesystem. This will attempt to make file extents more contiguous.
138 .INDENT 0.0
139 .INDENT 3.5
140 .sp
141 .EX
142 # btrfs filesystem defrag \-v \-r \-f \-t 32M /mnt/btrfs
143 .EE
144 .UNINDENT
145 .UNINDENT
146 .sp
147 Verbose recursive defragmentation (\fI\-v\fP, \fI\-r\fP), flush data per\-file (\fI\-f\fP) with
148 target extent size 32MiB (\fI\-t\fP).
149 .sp
150 \fBATTEMPT TO MAKE BTRFS METADATA MORE COMPACT\fP
151 .sp
152 Optional but recommended step.
153 .sp
154 The metadata block groups after conversion may be smaller than the default size
155 (256MiB or 1GiB). Running a balance will attempt to merge the block groups.
156 This depends on the free space layout (and fragmentation) and may fail due to
157 lack of enough work space. This is a soft error leaving the filesystem usable
158 but the block group layout may remain unchanged.
159 .sp
160 Note that balance operation takes a lot of time, please see also
161 \fI\%btrfs\-balance(8)\fP\&.
162 .INDENT 0.0
163 .INDENT 3.5
164 .sp
165 .EX
166 # btrfs balance start \-m /mnt/btrfs
167 .EE
168 .UNINDENT
169 .UNINDENT
170 .SH OPTIONS
171 .INDENT 0.0
172 .TP
173 .BI \-\-csum \ <type>\fR,\fB \ \-\-checksum \ <type>
174 Specify the checksum algorithm. Default is \fIcrc32c\fP\&. Valid values are \fIcrc32c\fP,
175 \fIxxhash\fP, \fIsha256\fP or \fIblake2\fP\&. To mount such filesystem kernel must support the
176 checksums as well.
177 .UNINDENT
178 .INDENT 0.0
179 .TP
180 .B \-d|\-\-no\-datasum
181 disable data checksum calculations and set the NODATASUM file flag, this can speed
182 up the conversion
183 .TP
184 .B \-i|\-\-no\-xattr
185 ignore xattrs and ACLs of files
186 .TP
187 .B \-n|\-\-no\-inline
188 disable inlining of small files to metadata blocks, this will decrease the metadata
189 consumption and may help to convert a filesystem with low free space
190 .TP
191 .B \-N|\-\-nodesize <SIZE>
192 set filesystem nodesize, the tree block size in which btrfs stores its metadata.
193 The default value is 16KiB (16384) or the page size, whichever is bigger.
194 Must be a multiple of the sectorsize, but not larger than 65536. See
195 \fI\%mkfs.btrfs(8)\fP for more details.
196 .TP
197 .B \-r|\-\-rollback
198 rollback to the original ext2/3/4 filesystem if possible
199 .TP
200 .B \-l|\-\-label <LABEL>
201 set filesystem label during conversion
202 .TP
203 .B \-L|\-\-copy\-label
204 use label from the converted filesystem
205 .TP
206 .B \-O|\-\-features <feature1>[,<feature2>...]
207 A list of filesystem features enabled the at time of conversion. Not all features
208 are supported by old kernels. To disable a feature, prefix it with \fI^\fP\&.
209 Description of the features is in section
210 \fI\%FILESYSTEM FEATURES\fP of
211 \fI\%mkfs.btrfs(8)\fP\&.
212 .sp
213 To see all available features that btrfs\-convert supports run:
214 .INDENT 7.0
215 .INDENT 3.5
216 .sp
217 .EX
218 btrfs\-convert \-O list\-all
219 .EE
220 .UNINDENT
221 .UNINDENT
222 .TP
223 .B \-p|\-\-progress
224 show progress of conversion (a heartbeat indicator and number of inodes
225 processed), on by default
226 .UNINDENT
227 .INDENT 0.0
228 .TP
229 .B \-\-no\-progress
230 disable progress and show only the main phases of conversion
231 .TP
232 .BI \-\-uuid \ <SPEC>
233 set the FSID of the new filesystem based on \(aqSPEC\(aq:
234 .INDENT 7.0
235 .IP \(bu 2
236 \fInew\fP \- (default) generate UUID for the FSID of btrfs
237 .IP \(bu 2
238 \fIcopy\fP \- copy UUID from the source filesystem
239 .IP \(bu 2
240 \fIUUID\fP \- a conforming UUID value, the 36 byte string representation
241 .UNINDENT
242 .TP
243 .B \-\-version
244 Print the \fBbtrfs\-convert\fP version, builtin features and exit.
245 .UNINDENT
246 .SH EXIT STATUS
247 .sp
248 \fBbtrfs\-convert\fP will return 0 if no error happened.
249 If any problems happened, 1 will be returned.
250 .SH SEE ALSO
251 .sp
252 \fI\%mkfs.btrfs(8)\fP
253 .\" Generated by docutils manpage writer.
254 .