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