2014-04-02 08:29:28 +00:00
|
|
|
btrfs-convert(8)
|
|
|
|
================
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2016-07-14 21:43:38 +00:00
|
|
|
btrfs-convert - convert from ext2/3/4 filesystem to btrfs in-place
|
2014-04-02 08:29:28 +00:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
2014-05-19 15:49:35 +00:00
|
|
|
*btrfs-convert* [options] <device>
|
2014-04-02 08:29:28 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
2015-11-02 13:19:58 +00:00
|
|
|
*btrfs-convert* is used to convert existing ext2/3/4 filesystem image to a
|
|
|
|
btrfs filesystem in-place. The original filesystem image is accessible
|
|
|
|
subvolume named 'ext2_saved' as file 'image'.
|
2014-04-02 08:29:28 +00:00
|
|
|
|
2015-11-02 13:19:58 +00:00
|
|
|
WARNING: If you are going to perform rollback to ext2/3/4, you should not
|
|
|
|
execute *btrfs balance* command on the converted filesystem. This will change
|
|
|
|
the extent layout and make *btrfs-convert* unable to rollback.
|
2015-04-03 07:23:13 +00:00
|
|
|
|
2015-11-02 13:19:58 +00:00
|
|
|
The conversion utilizes free space of the original filesystem. The exact
|
|
|
|
estimate of the required space cannot be foretold. The final btrfs metadata
|
|
|
|
might occupy several gigabytes on a hundreds-gigabyte filesystem.
|
|
|
|
|
|
|
|
If you decide not to rollback anymore, it is recommended to perform a few more
|
|
|
|
steps to transform the btrfs filesystem to a more compact layout. The
|
|
|
|
conversion inherits the original data block fragmentation and the metadata
|
|
|
|
blocks are bound to the original free space layout.
|
|
|
|
|
2016-07-14 21:43:38 +00:00
|
|
|
Due to different constraints, it's possible to convert only filesystem that
|
|
|
|
have supported data block size (ie. the same that would be valid for
|
|
|
|
'mkfs.btrfs'). This is typically the system page size (4KiB on x86_64
|
|
|
|
machines).
|
|
|
|
|
2015-11-02 13:19:58 +00:00
|
|
|
**REMOVE THE ORIGINAL FILESYSTEM METADATA**
|
|
|
|
|
|
|
|
By removing the 'ext2_saved' subvolume, all metadata of the original filesystem
|
|
|
|
will be removed:
|
|
|
|
|
|
|
|
# btrfs subvolume delete /mnt/ext2_saved
|
|
|
|
|
|
|
|
At this point it's not possible to do rollback. The filesystem is usable but may
|
2016-07-14 21:43:38 +00:00
|
|
|
be impacted by the fragmentation inherited from the original filesystem.
|
2015-11-02 13:19:58 +00:00
|
|
|
|
|
|
|
**MAKE FILE DATA MORE CONTIGUOUS**
|
|
|
|
|
|
|
|
An optional but recommended step is to run defragmentation on the entire
|
|
|
|
filesystem. This will attempt to make file extents more contiguous.
|
|
|
|
|
|
|
|
# btrfs filesystem defrag -v -r -f -t 32M /mnt/btrfs
|
|
|
|
|
2016-07-14 21:43:38 +00:00
|
|
|
Verbose recursive defragmentation ('-v', '-r'), flush data per-file ('-f') with
|
|
|
|
target extent size 32MiB ('-t').
|
2015-11-02 13:19:58 +00:00
|
|
|
|
|
|
|
**ATTEMPT TO MAKE BTRFS METADATA MORE COMPACT**
|
|
|
|
|
|
|
|
Optional but recommended step.
|
|
|
|
|
|
|
|
The metadata block groups after conversion may be smaller than the default size
|
|
|
|
(256MiB or 1GiB). Running a balance will attempt to merge the block groups.
|
2016-07-14 21:43:38 +00:00
|
|
|
This depends on the free space layout (and fragmentation) and may fail due to
|
|
|
|
lack of enough work space. This is a soft error leaving the filesystem usable
|
|
|
|
but the block group layout may remain unchanged.
|
2015-11-02 13:19:58 +00:00
|
|
|
|
2016-07-14 21:43:38 +00:00
|
|
|
Note that balance operation takes a lot of time, please see also
|
|
|
|
`btrfs-balance`(8).
|
2015-11-02 13:19:58 +00:00
|
|
|
|
|
|
|
# btrfs balance start -m /mnt/btrfs
|
2015-04-03 07:23:13 +00:00
|
|
|
|
2014-04-02 08:29:28 +00:00
|
|
|
OPTIONS
|
|
|
|
-------
|
2015-03-23 17:45:56 +00:00
|
|
|
-d|--no-datasum::
|
2016-07-14 21:43:38 +00:00
|
|
|
disable data checksum calculations and set the NODATASUM file flag, this can speed
|
2015-11-02 13:19:58 +00:00
|
|
|
up the conversion
|
2015-03-23 17:45:56 +00:00
|
|
|
-i|--no-xattr::
|
2015-11-02 13:19:58 +00:00
|
|
|
ignore xattrs and ACLs of files
|
2015-03-23 17:45:56 +00:00
|
|
|
-n|--no-inline::
|
2015-11-02 13:19:58 +00:00
|
|
|
disable inlining of small files to metadata blocks, this will decrease the metadata
|
|
|
|
consumption and may help to convert a filesystem with low free space
|
2015-03-23 17:45:56 +00:00
|
|
|
-N|--nodesize <SIZE>::
|
2015-11-02 13:19:58 +00:00
|
|
|
set filesystem nodesize, the tree block size in which btrfs stores its metadata.
|
2015-03-20 01:11:11 +00:00
|
|
|
The default value is 16KB (16384) or the page size, whichever is bigger.
|
2016-03-14 13:10:16 +00:00
|
|
|
Must be a multiple of the sectorsize, but not larger than 65536. See
|
2015-11-02 13:19:58 +00:00
|
|
|
`mkfs.btrfs`(8) for more details.
|
2015-03-23 17:45:56 +00:00
|
|
|
-r|--rollback::
|
2015-11-02 13:19:58 +00:00
|
|
|
rollback to the original ext2/3/4 filesystem if possible
|
2015-03-23 17:45:56 +00:00
|
|
|
-l|--label <LABEL>::
|
2015-11-02 13:19:58 +00:00
|
|
|
set filesystem label during conversion
|
2015-03-23 17:45:56 +00:00
|
|
|
-L|--copy-label::
|
2015-11-02 13:19:58 +00:00
|
|
|
use label from the converted filesystem
|
2016-03-02 16:00:28 +00:00
|
|
|
-O|--features <feature1>[,<feature2>...]::
|
2016-07-14 21:43:38 +00:00
|
|
|
A list of filesystem features turned on at conversion time. Not all features
|
2016-03-02 16:00:28 +00:00
|
|
|
are supported by old kernels. To disable a feature, prefix it with '^'.
|
2016-07-14 21:43:38 +00:00
|
|
|
Description of the features is in section 'FILESYSTEM FEATURES' of
|
|
|
|
`mkfs.btrfs`(8).
|
2016-03-02 16:00:28 +00:00
|
|
|
+
|
|
|
|
To see all available features that btrfs-convert supports run:
|
|
|
|
+
|
|
|
|
+btrfs-convert -O list-all+
|
2016-06-10 13:57:55 +00:00
|
|
|
+
|
2015-03-23 17:45:56 +00:00
|
|
|
-p|--progress::
|
2016-07-14 21:43:38 +00:00
|
|
|
show progress of conversion (a heartbeat indicator and number of inodes
|
|
|
|
processed), on by default
|
2015-03-09 10:56:04 +00:00
|
|
|
--no-progress::
|
2016-07-14 21:43:38 +00:00
|
|
|
disable progress and show only the main phases of conversion
|
2014-04-02 08:29:28 +00:00
|
|
|
|
|
|
|
EXIT STATUS
|
|
|
|
-----------
|
2014-05-19 15:49:35 +00:00
|
|
|
*btrfs-convert* will return 0 if no error happened.
|
2014-04-02 08:29:28 +00:00
|
|
|
If any problems happened, 1 will be returned.
|
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
|
|
|
`mkfs.btrfs`(8)
|