2014-04-02 08:29:28 +00:00
|
|
|
btrfs-convert(8)
|
|
|
|
================
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2017-08-22 17:18:48 +00:00
|
|
|
btrfs-convert - convert from ext2/3/4 or reiserfs 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
|
|
|
|
-----------
|
2017-08-22 17:18:48 +00:00
|
|
|
*btrfs-convert* is used to convert existing source filesystem image to a btrfs
|
|
|
|
filesystem in-place. The original filesystem image is accessible in subvolume
|
|
|
|
named like 'ext2_saved' as file 'image'.
|
2014-04-02 08:29:28 +00:00
|
|
|
|
2017-08-22 17:18:48 +00:00
|
|
|
Supported filesystems:
|
|
|
|
|
|
|
|
* ext2, ext3, ext4 -- original feature, always built in
|
|
|
|
|
2017-12-07 20:26:09 +00:00
|
|
|
* reiserfs -- since version 4.13, optionally built, requires libreiserfscore 3.6.27
|
2017-08-22 17:18:48 +00:00
|
|
|
|
|
|
|
The list of supported source filesystem by a given binary is listed at the end
|
|
|
|
of help (option '--help').
|
|
|
|
|
|
|
|
WARNING: If you are going to perform rollback to the original filesystem, 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.
|
|
|
|
|
2017-12-07 20:26:09 +00:00
|
|
|
If the ability to rollback is no longer important, the it is recommended to
|
|
|
|
perform a few more steps to transition the btrfs filesystem to a more compact
|
|
|
|
layout. This is because the conversion inherits the original data blocks'
|
|
|
|
fragmentation, and also because the metadata blocks are bound to the original
|
|
|
|
free space layout.
|
2015-11-02 13:19:58 +00:00
|
|
|
|
2017-12-07 20:26:09 +00:00
|
|
|
Due to different constraints, it is only possible to convert filesystems that
|
|
|
|
have a supported data block size (ie. the same that would be valid for
|
2016-07-14 21:43:38 +00:00
|
|
|
'mkfs.btrfs'). This is typically the system page size (4KiB on x86_64
|
|
|
|
machines).
|
|
|
|
|
2016-09-15 12:08:52 +00:00
|
|
|
NOTE: The source filesystem should be clean, you are encouraged to run the
|
|
|
|
'fsck' tool if you're not sure.
|
|
|
|
|
2015-11-02 13:19:58 +00:00
|
|
|
**REMOVE THE ORIGINAL FILESYSTEM METADATA**
|
|
|
|
|
2017-08-22 17:18:48 +00:00
|
|
|
By removing the subvolume named like 'ext2_saved' or 'reiserfs_saved', all
|
|
|
|
metadata of the original filesystem will be removed:
|
2015-11-02 13:19:58 +00:00
|
|
|
|
|
|
|
# btrfs subvolume delete /mnt/ext2_saved
|
|
|
|
|
2017-12-07 20:26:09 +00:00
|
|
|
At this point it is not possible to do a rollback. The filesystem is usable but
|
|
|
|
may 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
|
|
|
|
-------
|
2019-11-05 19:31:04 +00:00
|
|
|
--csum <type>::
|
|
|
|
--checksum <type>::
|
|
|
|
Specify the checksum algorithm. Default is 'crc32c'. Valid values are 'crc32c',
|
|
|
|
'xxhash', 'sha256' or 'blake2'. To mount such filesystem kernel must support the
|
|
|
|
checksums as well.
|
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>...]::
|
2017-12-07 20:26:09 +00:00
|
|
|
A list of filesystem features enabled the at time of conversion. 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)
|