linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: Files seen by some apps and not others
Date: Sun, 12 Jun 2016 02:18:33 +0000 (UTC)	[thread overview]
Message-ID: <pan$dc991$bc4b5712$73c16333$5c108126@cox.net> (raw)
In-Reply-To: CAMPo9spCUSEwMBhGWcr1iX0ny28e52GYMO4D=eug-MZaWB0iEQ@mail.gmail.com

Bearcat Şándor posted on Sat, 11 Jun 2016 13:54:44 -0600 as excerpted:

> I'm about to try a btrfs restore to see what it can do for me. Any
> pointers or help here? I don't want to fsck things up further.

FWIW, btrfs restore doesn't write anything at all to the filesystem it's 
restoring from -- it's read-only in that regard -- so you really don't 
have to worry about it screwing up a filesystem further.

But by the same token, btrfs restore may not do what you think it does.  
It doesn't try to fix the filesystem.  Rather, it's a way to try to 
salvage anything you can off a filesystem that won't mount, or, as it 
would be used here, that will mount but where files aren't showing up 
properly so you can't just copy them elsewhere using normal means.  It 
writes the files it can salvage to some other filesystem, which of course 
means that whatever filesystem you're writing the files to must have 
enough room for the files to be written.

Also note the various restore options.  In particular, the restore 
metadata option must be used if you want to restore the same ownership, 
permissions and timestamp information.  Otherwise, restore simply writes 
the files as the user you're running it as (root), using the current 
umask.  Similarly, if you want to restore symlinks and extended 
attributes, there's options for that, otherwise they aren't restored.

And you won't necessarily be wanting to restore snapshots, as you should 
have backups if needed for the history, and are likely most worried about 
the current version of the files, so snapshots aren't restored unless you 
use the appropriate option.

Given that the filesystem is still mounted and most files are apparently 
still readable normally, you may want to copy off what you can that way, 
and only restore specific files using btrfs restore.  Or you may not have 
room on the destination filesystem to restore everything, and will need 
to pick only the most important stuff to restore.  That's where the 
pattern-match option comes in.

What I did here when I used restore (I had backups of course but they 
weren't current) was use the metadata and symlinks restore options, and 
simply restored everything.

Note that if a particular directory has a lot of files, restore will 
begin to think that it's looping to much and that it's stuck.  It'll 
prompt you to continue, and may prompt a *LOT*.  Here I have multiple 
independent small filesystems, so it wasn't a big deal, but you may need 
to experiment with automating the "yes" if your filesystem is huge 
(piping the output of the yes command to stdin, for instance, or similar 
sysadmin prompt automation tricks).  A number of folks have mentioned 
that and requested a way to say "yes, really all, don't ask again", an 
option that btrfs restore unfortunately doesn't have yet.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


  reply	other threads:[~2016-06-12  2:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-11 19:54 Files seen by some apps and not others Bearcat Şándor
2016-06-12  2:18 ` Duncan [this message]
2016-06-12  6:47   ` Bearcat Şándor
2016-06-12 15:47     ` Henk Slager
2016-06-12 23:06       ` Bearcat Şándor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='pan$dc991$bc4b5712$73c16333$5c108126@cox.net' \
    --to=1i5t5.duncan@cox.net \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).