{
    "mode": "man",
    "parameter": "btrfs-image",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/btrfs-image/8/json",
    "generated": "2026-10-09T16:50:34Z",
    "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 de‐\nvice/file.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-r",
                    "content": "pointing  to  primary  device, so that file system can be restored by running tree log\nreply if possible. To restore without changing number of stripes in chunk  tree  check\n-o option.\n",
                    "flag": "-r"
                },
                {
                    "name": "-c _",
                    "content": "Compression level (0 ~ 9).\n",
                    "flag": "-c"
                },
                {
                    "name": "-t _",
                    "content": "Number of threads (1 ~ 32) to be used to process the image dump or restore.\n",
                    "flag": "-t"
                },
                {
                    "name": "-o",
                    "content": "system will not be able to be mounted.\n",
                    "flag": "-o"
                },
                {
                    "name": "-s",
                    "content": "garbage,  which means that the directory indexes won't match up since the hashes won't\nmatch with the garbage filenames. Using -s will calculate a collision for the filename\nso that the hashes match, and if it can't calculate a collision then it will just gen‐\nerate 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 work‐\ning.\n",
                    "flag": "-s"
                },
                {
                    "name": "-w",
                    "content": "if your extent tree is corrupted to make sure that all of the metadata is captured.\n",
                    "flag": "-w"
                },
                {
                    "name": "-m",
                    "content": "",
                    "flag": "-m"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "btrfs-image  will  return  0  if  no error happened.  If any problems happened, 1 will be re‐\nturned.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "mkfs.btrfs(8)\n\n\n6.6.3                                       Mar 31, 2024                              BTRFS-IMAGE(8)",
            "subsections": []
        }
    },
    "summary": "btrfs-image - create/restore an image of the filesystem",
    "flags": [
        {
            "flag": "-r",
            "long": null,
            "arg": null,
            "description": "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."
        },
        {
            "flag": "-c",
            "long": null,
            "arg": null,
            "description": "Compression level (0 ~ 9)."
        },
        {
            "flag": "-t",
            "long": null,
            "arg": null,
            "description": "Number of threads (1 ~ 32) to be used to process the image dump or restore."
        },
        {
            "flag": "-o",
            "long": null,
            "arg": null,
            "description": "system will not be able to be mounted."
        },
        {
            "flag": "-s",
            "long": null,
            "arg": null,
            "description": "garbage, which means that the directory indexes won't match up since the hashes won't match with the garbage filenames. Using -s will calculate a collision for the filename so that the hashes match, and if it can't calculate a collision then it will just gen‐ erate 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 work‐ ing."
        },
        {
            "flag": "-w",
            "long": null,
            "arg": null,
            "description": "if your extent tree is corrupted to make sure that all of the metadata is captured."
        },
        {
            "flag": "-m",
            "long": null,
            "arg": null,
            "description": ""
        }
    ],
    "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"
        }
    ]
}