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