BTRFS-RESTORE(8)
π NAME π
btrfs-restore β bestie's emergency rescue mission: try to restore files from a damaged filesystem image π«Ά
β¨ SYNOPSIS β¨
btrfs restore [options] <device> <path> | -l <device>
πΈ DESCRIPTION πΈ
okay so btrfs restore is literally the "my filesystem is fighting for its life" tool. It tries to salvage files out of a damaged filesystem and drop them into path β or it can just list the subvolume tree roots for you instead. And the most important thing: the filesystem image is not modified. Not one bit. Read-only queen behavior π
Here's the vibe check: if your filesystem is damaged and the other tools can't fix it β and by "other tools" I mean btrfs-check(8) and btrfs-rescue(8) β then btrfs restore is who you call. It'll go retrieve file data as far as the metadata is readable. The checks it runs are way less strict, which lowkey means it usually gets far enough to pull data from the whole filesystem. Slay? Kinda. But there's a catch, and it's a real one: some data might be incomplete, or might be from older versions if those happen to be available. So no cap β you might get your file, you might get an older version of your file. Still eating though π
There's a whole menu of options for restoring different kinds of file metadata. Bestie strategy: do a dry run first to see how the process goes, then layer on more options to widen the set of restored metadata. Vibe check before the rescue mission, yk?
And if you're dealing with images that have damaged tree structures, there are several options to point the process at some spare copy. Safe backups come in clutch π¦
π OPTIONS π
-s,--snapshotsβ get the snapshots too! they're skipped by default, so you have to ask nicely β¨-x,--xattrβ grab the extended attributes as well π-m,--metadataβ restore owner, mode and times for files and directories. the whole little identity of the file, restored π«Ά-S,--symlinksβ restore symbolic links, not just normal files π-i,--ignore-errorsβ ignore errors during restoration and just keep going. she's unbothered. she's continuing π-o,--overwriteβ overwrite directories/files in path, e.g. for repeated runs. so you can run it again and again without the old stuff in the way π₯-t<bytenr>β use bytenr to read the root tree β-f<bytenr>β only restore files that are under the specified subvolume root, the one pointed to by bytenr-u,--super<mirror>β use the given superblock mirror, identified by<mirror>. it can be0,1or2(those are the only options, don't get creative π)-r,--root<rootid>β only restore files that are under a specified subvolume whose objectid is rootid-dβ find directory-l,--list-rootsβ list subvolume tree roots! and plot twist, this output can be used as an argument for-rπ-D,--dry-runβ dry run: only list the files that would be recovered. no actual restoring, just a little preview β¨--path-regex<regex>β restore only filenames matching a regular expression (that'sregex(7), linked over at <https://man7.org/linux/man-pages/man7/regex.7.html>) with a mandatory format:
^/(|home(|/username(|/Desktop(|/.*))))$
fr fr, the format is not very comfortable, and it restores all files in the directories in the whole path. so this is not useful for restoring a single file in a deep hierarchy. it's giving "well, sort of" π«
-cβ ignore case (--path-regexonly)-v,--verboseβ (deprecated) alias for the global-voption. she's old, she's legacy, be gentle π₯²
π Global options π
-v,--verboseβ be verbose and print what is being restored. yes bestie, tell me everything π¬
π EXIT STATUS π
btrfs restore returns a zero exit status if it succeeds. Non zero gets returned in case of failure. Zero = we ate. Non-zero = we did not eat π
π§ AVAILABILITY π§
btrfs is part of btrfs-progs. Please refer to the documentation at <https://btrfs.readthedocs.io>. go read the docs, they're right there, they're free π
π¦ SEE ALSO π¦
btrfs-check(8), btrfs-rescue(8), mkfs.btrfs(8)
okay that's the whole page, you're officially trained π this was version 7.3 from Oct 24, 2026 β take care of your filesystems and back them up, i'm literally begging you ππ
π¦ where this page comes from
- arch rolling: btrfs-progs 7.3-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms