{
    "content": [
        {
            "type": "text",
            "text": "# btrfs-convert(8) (man)\n\n**Summary:** btrfs-convert - convert from ext2/3/4 or reiserfs filesystem to btrfs in-place\n\n**Synopsis:** btrfs-convert [options] <device>\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| — | --no-progress | — | disable progress and show only the main phases of conversion --uuid <SPEC> set the FSID of the new filesystem based on S |\n\n## See Also\n\n- mkfs.btrfs(8)\n- BTRFS-CONVERT(8)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (2 lines)\n- **DESCRIPTION** (82 lines)\n- **OPTIONS** (42 lines) — 1 subsections\n  - --no-progress (11 lines)\n- **EXIT STATUS** (3 lines)\n- **SEE ALSO** (5 lines)\n\n## Full Content\n\n### NAME\n\nbtrfs-convert - convert from ext2/3/4 or reiserfs filesystem to btrfs in-place\n\n### SYNOPSIS\n\nbtrfs-convert [options] <device>\n\n### DESCRIPTION\n\nbtrfs-convert is used to convert existing source filesystem image to a btrfs filesystem\nin-place. The original filesystem image is accessible in subvolume named like ext2saved as\nfile image.\n\nSupported filesystems:\n\n•   ext2, ext3, ext4 — original feature, always built in\n\n•   reiserfs — since version 4.13, optionally built, requires libreiserfscore 3.6.27\n\n•   ntfs — external tool https://github.com/maharmstone/ntfs2btrfs\n\nThe list of supported source filesystem by a given binary is listed at the end of help\n(option --help).\n\nWarning\nIf you are going to perform rollback to the original filesystem, you should not execute\nbtrfs balance command on the converted filesystem. This will change the extent layout and\nmake btrfs-convert unable to rollback.\n\nThe conversion utilizes free space of the original filesystem. The exact estimate of the\nrequired space cannot be foretold. The final btrfs metadata might occupy several gigabytes on\na hundreds-gigabyte filesystem.\n\nIf the ability to rollback is no longer important, the it is recommended to perform a few\nmore steps to transition the btrfs filesystem to a more compact layout. This is because the\nconversion inherits the original data blocks' fragmentation, and also because the metadata\nblocks are bound to the original free space layout.\n\nDue to different constraints, it is only possible to convert filesystems that have a\nsupported data block size (ie. the same that would be valid for mkfs.btrfs). This is\ntypically the system page size (4KiB on x8664 machines).\n\nBEFORE YOU START\n\nThe source filesystem must be clean, eg. no journal to replay or no repairs needed. The\nrespective fsck utility must be run on the source filesystem prior to conversion. Please\nrefer to the manual pages in case you encounter problems.\n\nFor ext2/3/4:\n\n# e2fsck -fvy /dev/sdx\n\nFor reiserfs:\n\n# reiserfsck -fy /dev/sdx\n\nSkipping that step could lead to incorrect results on the target filesystem, but it may work.\n\nREMOVE THE ORIGINAL FILESYSTEM METADATA\n\nBy removing the subvolume named like ext2saved or reiserfssaved, all metadata of the\noriginal filesystem will be removed:\n\n# btrfs subvolume delete /mnt/ext2saved\n\nAt this point it is not possible to do a rollback. The filesystem is usable but may be\nimpacted by the fragmentation inherited from the original filesystem.\n\nMAKE FILE DATA MORE CONTIGUOUS\n\nAn optional but recommended step is to run defragmentation on the entire filesystem. This\nwill attempt to make file extents more contiguous.\n\n# btrfs filesystem defrag -v -r -f -t 32M /mnt/btrfs\n\nVerbose recursive defragmentation (-v, -r), flush data per-file (-f) with target extent size\n32MiB (-t).\n\nATTEMPT TO MAKE BTRFS METADATA MORE COMPACT\n\nOptional but recommended step.\n\nThe metadata block groups after conversion may be smaller than the default size (256MiB or\n1GiB). Running a balance will attempt to merge the block groups. This depends on the free\nspace layout (and fragmentation) and may fail due to lack of enough work space. This is a\nsoft error leaving the filesystem usable but the block group layout may remain unchanged.\n\nNote that balance operation takes a lot of time, please see also btrfs-balance(8).\n\n# btrfs balance start -m /mnt/btrfs\n\n### OPTIONS\n\n--csum <type>, --checksum <type>\nSpecify the checksum algorithm. Default is crc32c. Valid values are crc32c, xxhash,\nsha256 or blake2. To mount such filesystem kernel must support the checksums as well.\n\n-d|--no-datasum\ndisable data checksum calculations and set the NODATASUM file flag, this can speed up the\nconversion\n\n-i|--no-xattr\nignore xattrs and ACLs of files\n\n-n|--no-inline\ndisable inlining of small files to metadata blocks, this will decrease the metadata\nconsumption and may help to convert a filesystem with low free space\n\n-N|--nodesize <SIZE>\nset filesystem nodesize, the tree block size in which btrfs stores its metadata. The\ndefault value is 16KB (16384) or the page size, whichever is bigger. Must be a multiple\nof the sectorsize, but not larger than 65536. See mkfs.btrfs(8) for more details.\n\n-r|--rollback\nrollback to the original ext2/3/4 filesystem if possible\n\n-l|--label <LABEL>\nset filesystem label during conversion\n\n-L|--copy-label\nuse label from the converted filesystem\n\n-O|--features <feature1>[,<feature2>...]\nA list of filesystem features enabled the at time of conversion. Not all features are\nsupported by old kernels. To disable a feature, prefix it with ^. Description of the\nfeatures is in section FILESYSTEM FEATURES of mkfs.btrfs(8).\n\nTo see all available features that btrfs-convert supports run:\n\nbtrfs-convert -O list-all\n\n-p|--progress\nshow progress of conversion (a heartbeat indicator and number of inodes processed), on by\ndefault\n\n#### --no-progress\n\ndisable progress and show only the main phases of conversion\n\n--uuid <SPEC>\nset the FSID of the new filesystem based on SPEC:\n\n•   new - (default) generate UUID for the FSID of btrfs\n\n•   copy - copy UUID from the source filesystem\n\n•   UUID - a conforming UUID value, the 36 byte string representation\n\n### EXIT STATUS\n\nbtrfs-convert will return 0 if no error happened. If any problems happened, 1 will be\nreturned.\n\n### SEE ALSO\n\nmkfs.btrfs(8)\n\n\n\nBtrfs v5.16.2                                02/16/2022                             BTRFS-CONVERT(8)\n\n"
        }
    ],
    "structuredContent": {
        "command": "btrfs-convert",
        "section": "8",
        "mode": "man",
        "summary": "btrfs-convert - convert from ext2/3/4 or reiserfs filesystem to btrfs in-place",
        "synopsis": "btrfs-convert [options] <device>",
        "flags": [
            {
                "flag": "",
                "long": "--no-progress",
                "arg": null,
                "description": "disable progress and show only the main phases of conversion --uuid <SPEC> set the FSID of the new filesystem based on SPEC: • new - (default) generate UUID for the FSID of btrfs • copy - copy UUID from the source filesystem • UUID - a conforming UUID value, the 36 byte string representation"
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "mkfs.btrfs",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/mkfs.btrfs/8/json"
            },
            {
                "name": "BTRFS-CONVERT",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/BTRFS-CONVERT/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 82,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 42,
                "subsections": [
                    {
                        "name": "--no-progress",
                        "lines": 11,
                        "long": "--no-progress"
                    }
                ]
            },
            {
                "name": "EXIT STATUS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}