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