{
    "mode": "man",
    "parameter": "btrfs-image",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/btrfs-image/8/json",
    "generated": "2026-06-15T16:43:12Z",
    "synopsis": "btrfs-image [options] <source> <target>",
    "sections": {
        "NAME": {
            "content": "btrfs-image - create/restore an image of the filesystem\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "btrfs-image [options] <source> <target>\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "btrfs-image is used to create an image of a btrfs filesystem. All data will be zeroed, but\nmetadata and the like is preserved. Mainly used for debugging purposes.\n\nIn the dump mode, source is the btrfs device/file and target is the output file (use - for\nstdout).\n\nIn the restore mode (option -r), source is the dumped image and target is the btrfs\ndevice/file.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-r",
                    "content": "Restore metadump image. By default, this fixes super’s chunk tree, by using 1 stripe\npointing to primary device, so that file system can be restored by running tree log reply\nif possible. To restore without changing number of stripes in chunk tree check -o option.\n\n-c <value>\nCompression level (0 ~ 9).\n\n-t <value>\nNumber of threads (1 ~ 32) to be used to process the image dump or restore.\n",
                    "flag": "-r"
                },
                {
                    "name": "-o",
                    "content": "Use the old restore method, this does not fixup the chunk tree so the restored file\nsystem will not be able to be mounted.\n",
                    "flag": "-o"
                },
                {
                    "name": "-s",
                    "content": "Sanitize the file names when generating the image. One -s means just generate random\ngarbage, which means that the directory indexes won’t match up since the hashes won’t\nmatch with the garbage filenames. Using -ss will calculate a collision for the filename\nso that the hashes match, and if it can’t calculate a collision then it will just\ngenerate garbage. The collision calculator is very time and CPU intensive so only use it\nif you are having problems with your file system tree and need to have it mostly working.\n",
                    "flag": "-s"
                },
                {
                    "name": "-w",
                    "content": "Walk all the trees manually and copy any blocks that are referenced. Use this option if\nyour extent tree is corrupted to make sure that all of the metadata is captured.\n",
                    "flag": "-w"
                },
                {
                    "name": "-m",
                    "content": "Restore for multiple devices, more than 1 device should be provided.\n",
                    "flag": "-m"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "btrfs-image will return 0 if no error happened. If any problems happened, 1 will be returned.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "mkfs.btrfs(8)\n\n\n\nBtrfs v5.16.2                                02/16/2022                               BTRFS-IMAGE(8)",
            "subsections": []
        }
    },
    "summary": "btrfs-image - create/restore an image of the filesystem",
    "flags": [
        {
            "flag": "-r",
            "long": null,
            "arg": null,
            "description": "Restore metadump image. By default, this fixes super’s chunk tree, by using 1 stripe pointing to primary device, so that file system can be restored by running tree log reply if possible. To restore without changing number of stripes in chunk tree check -o option. -c <value> Compression level (0 ~ 9). -t <value> Number of threads (1 ~ 32) to be used to process the image dump or restore."
        },
        {
            "flag": "-o",
            "long": null,
            "arg": null,
            "description": "Use the old restore method, this does not fixup the chunk tree so the restored file system will not be able to be mounted."
        },
        {
            "flag": "-s",
            "long": null,
            "arg": null,
            "description": "Sanitize the file names when generating the image. One -s means just generate random garbage, which means that the directory indexes won’t match up since the hashes won’t match with the garbage filenames. Using -ss will calculate a collision for the filename so that the hashes match, and if it can’t calculate a collision then it will just generate garbage. The collision calculator is very time and CPU intensive so only use it if you are having problems with your file system tree and need to have it mostly working."
        },
        {
            "flag": "-w",
            "long": null,
            "arg": null,
            "description": "Walk all the trees manually and copy any blocks that are referenced. Use this option if your extent tree is corrupted to make sure that all of the metadata is captured."
        },
        {
            "flag": "-m",
            "long": null,
            "arg": null,
            "description": "Restore for multiple devices, more than 1 device should be provided."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "mkfs.btrfs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs.btrfs/8/json"
        },
        {
            "name": "BTRFS-IMAGE",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/BTRFS-IMAGE/8/json"
        }
    ]
}