{
    "mode": "man",
    "parameter": "btrfs-restore",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/btrfs-restore/8/json",
    "generated": "2026-10-09T16:52:42Z",
    "synopsis": "btrfs restore [options] <device> <path> | -l <device>",
    "sections": {
        "NAME": {
            "content": "btrfs-restore - try to restore files from a damaged filesystem image\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "btrfs restore [options] <device> <path> | -l <device>\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "btrfs restore is used to try to salvage files from a damaged filesystem and restore them into\npath or just list the subvolume tree roots. The filesystem image is not modified.\n\nIf  the  filesystem  is  damaged and cannot be repaired by the other tools (btrfs-check(8) or\nbtrfs-rescue(8)), btrfs restore could be used to retrieve file data, as far as  the  metadata\nare  readable.  The checks done by restore are less strict and the process is usually able to\nget far enough to retrieve data from the whole filesystem. This comes at  a  cost  that  some\ndata might be incomplete or from older versions if they're available.\n\nThere  are several options to attempt restoration of various file metadata type.  You can try\na dry run first to see how well the process goes and use further options to extend the set of\nrestored metadata.\n\nFor images with damaged tree structures, there are several options to point  the  process  to\nsome spare copy.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-s|--snapshots",
                    "content": "get also snapshots that are skipped by default\n"
                },
                {
                    "name": "-x|--xattr",
                    "content": "get extended attributes\n"
                },
                {
                    "name": "-m|--metadata",
                    "content": "restore owner, mode and times for files and directories\n"
                },
                {
                    "name": "-S|--symlinks",
                    "content": "restore symbolic links as well as normal files\n"
                },
                {
                    "name": "-i|--ignore-errors",
                    "content": "ignore errors during restoration and continue\n"
                },
                {
                    "name": "-o|--overwrite",
                    "content": "overwrite directories/files in path, e.g. for repeated runs\n"
                },
                {
                    "name": "-t _",
                    "content": "use bytenr to read the root tree\n",
                    "flag": "-t"
                },
                {
                    "name": "-f _",
                    "content": "only restore files that are under specified subvolume root pointed by bytenr\n",
                    "flag": "-f"
                },
                {
                    "name": "-u|--super <mirror>",
                    "content": "use given superblock mirror identified by <mirror>, it can be 0,1 or 2\n"
                },
                {
                    "name": "-r|--root <rootid>",
                    "content": "only restore files that are under a specified subvolume whose objectid is rootid\n"
                },
                {
                    "name": "-d",
                    "content": "",
                    "flag": "-d"
                },
                {
                    "name": "-l|--list-roots",
                    "content": "list subvolume tree roots, can be used as argument for -r\n"
                },
                {
                    "name": "-D|--dry-run",
                    "content": "dry run (only list files that would be recovered)\n\n--path-regex <regex>\nrestore  only filenames matching a regular expression (regex(7)) with a mandatory for‐\nmat\n\n^/(|home(|/username(|/Desktop(|/.*))))$\n\nThe format is not very comfortable and restores all files in the  directories  in  the\nwhole path, so this is not useful for restoring single file in a deep hierarchy.\n"
                },
                {
                    "name": "-c",
                    "content": "",
                    "flag": "-c"
                },
                {
                    "name": "-v|--verbose",
                    "content": "(deprecated) alias for global -v option\n"
                },
                {
                    "name": "Global options",
                    "content": ""
                },
                {
                    "name": "-v|--verbose",
                    "content": "be verbose and print what is being restored\n"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "btrfs  restore  returns  a  zero  exit status if it succeeds. Non zero is returned in case of\nfailure.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "btrfs   is   part   of   btrfs-progs.     Please    refer    to    the    documentation    at\nhttps://btrfs.readthedocs.io.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "btrfs-check(8), btrfs-rescue(8), mkfs.btrfs(8)\n\n\n6.6.3                                       Mar 31, 2024                            BTRFS-RESTORE(8)",
            "subsections": []
        }
    },
    "summary": "btrfs-restore - try to restore files from a damaged filesystem image",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "get also snapshots that are skipped by default"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "get extended attributes"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "restore owner, mode and times for files and directories"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "restore symbolic links as well as normal files"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "ignore errors during restoration and continue"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "overwrite directories/files in path, e.g. for repeated runs"
        },
        {
            "flag": "-t",
            "long": null,
            "arg": null,
            "description": "use bytenr to read the root tree"
        },
        {
            "flag": "-f",
            "long": null,
            "arg": null,
            "description": "only restore files that are under specified subvolume root pointed by bytenr"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "use given superblock mirror identified by <mirror>, it can be 0,1 or 2"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "only restore files that are under a specified subvolume whose objectid is rootid"
        },
        {
            "flag": "-d",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "list subvolume tree roots, can be used as argument for -r"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "dry run (only list files that would be recovered) --path-regex <regex> restore only filenames matching a regular expression (regex(7)) with a mandatory for‐ mat ^/(|home(|/username(|/Desktop(|/.*))))$ The format is not very comfortable and restores all files in the directories in the whole path, so this is not useful for restoring single file in a deep hierarchy."
        },
        {
            "flag": "-c",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "(deprecated) alias for global -v option"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "be verbose and print what is being restored"
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "btrfs-check",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/btrfs-check/8/json"
        },
        {
            "name": "btrfs-rescue",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/btrfs-rescue/8/json"
        },
        {
            "name": "mkfs.btrfs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs.btrfs/8/json"
        },
        {
            "name": "BTRFS-RESTORE",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/BTRFS-RESTORE/8/json"
        }
    ]
}