6

I have a damaged btrfs filesystem, and I am using btrfs restore to restore it. It seems to work.

The problem is that the damaged filesystem is quite huge, and I need only to restore just one directory. I see from the man page the option

-d directory

but the wiki I see -d: ???. Do you how to use this flag and if it can help me?

4
  • According to btrfs-restore(8) Manual Page it is -d find dir. Does that help?. You can also use -D|--dry-run (only list files that would be recovered) to verify what will happen.
    – DavidPostill
    Commented Mar 22, 2015 at 12:36
  • not really. How to use it? How does it work? It restore only that dir? I get check_mounted(): Could not open my_directory. Do I have to mount it?
    – wiso
    Commented Mar 22, 2015 at 12:40
  • No idea .... :/
    – DavidPostill
    Commented Mar 22, 2015 at 12:41
  • 1
    Use the --path-regex <regex> option? restore only filenames matching regex, you have to use following syntax (possibly quoted): ^/(|home(|/username(|/Desktop(|/.*))))$
    – DavidPostill
    Commented Mar 22, 2015 at 12:55

1 Answer 1

6

How do I restore a specific directory using btrfs?

You can restore a directory using the --path-regex <regex> option with an appropriate regular expression.

You can also use -D|--dry-run to verify exactly what will be restored.


btrfs-restore - try to restore files from a damaged btrfs filesystem (unmounted)

-D|--dry-run

dry run (only list files that would be recovered).

--path-regex <regex>

restore only filenames matching regex, you have to use following syntax (possibly quoted):

^/(|home(|/username(|/Desktop(|/.*))))$

Source btrfs-restore(8) Manual Page

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .