linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Accidental formatting
@ 2012-02-06  3:41 Fahrzin Hemmati
  2012-02-06  7:40 ` Kai Krakow
  0 siblings, 1 reply; 3+ messages in thread
From: Fahrzin Hemmati @ 2012-02-06  3:41 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org

I recently re-installed Ubuntu, and somewhere along the way the 
installer decided to clear out /var, which happens to be a separate 
btrfs device from /. When I do "btfrs filesystem df /var" it outputs this:

Data: total=134.01GB, used=485.78
System, DUP: total=8.00MB, used=20.00KB
System: total=4.00MB, used=0.00
Metadata, DUP: total=1.62GB, used=6.87MB
Metadata: total=8.00MB, used=0.00

The reserved Data, 134GB, resembles closely the amount of data on my 
drive before the formatting. Therefore, I believe what happened was the 
installer didn't format /var, just cleared out the files. I didn't 
properly backup /var, but I have important files on it. Is there a way 
to have btrfs look around the reserved metadata area for orphaned files 
and get them back?

Thanks! Any help is greatly appreciated!
Fahrzin Hemmati

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Accidental formatting
  2012-02-06  3:41 Accidental formatting Fahrzin Hemmati
@ 2012-02-06  7:40 ` Kai Krakow
       [not found]   ` <CAD8hrTPmcuac6wtJPR=pHES1gQJ2Q+ft8OmNOOKopMQKmV+8qA@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Kai Krakow @ 2012-02-06  7:40 UTC (permalink / raw)
  To: linux-btrfs

Fahrzin Hemmati <fahhem2@gmail.com> schrieb:

> I recently re-installed Ubuntu, and somewhere along the way the
> installer decided to clear out /var, which happens to be a separate
> btrfs device from /. When I do "btfrs filesystem df /var" it outputs this:
> 
> Data: total=134.01GB, used=485.78
> System, DUP: total=8.00MB, used=20.00KB
> System: total=4.00MB, used=0.00
> Metadata, DUP: total=1.62GB, used=6.87MB
> Metadata: total=8.00MB, used=0.00
> 
> The reserved Data, 134GB, resembles closely the amount of data on my
> drive before the formatting. Therefore, I believe what happened was the
> installer didn't format /var, just cleared out the files. I didn't
> properly backup /var, but I have important files on it. Is there a way
> to have btrfs look around the reserved metadata area for orphaned files
> and get them back?

I'd try "photorec" on this although I believe it will be hard for photorec 
to recover the files due to btrfs' COW behaviour.

You could also try Josef's rescue tool or trying to intentionally corrupt 
you current tree root so you could use "mount -o recovery" to let btrfs 
mount an older tree root. This is just an idea, I think the btrfs folks here 
have better ideas how to accomplish mounting an older tree root.

HTH
Kai


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Accidental formatting
       [not found]   ` <CAD8hrTPmcuac6wtJPR=pHES1gQJ2Q+ft8OmNOOKopMQKmV+8qA@mail.gmail.com>
@ 2012-02-06  8:42     ` Kai Krakow
  0 siblings, 0 replies; 3+ messages in thread
From: Kai Krakow @ 2012-02-06  8:42 UTC (permalink / raw)
  To: Farz Hem; +Cc: linux-btrfs

It seems you didn't reply to the list (at least Gmail doesn't tell me
"via vger.kernel.org", I cc'ed your email address)... I've added the
list again.

Anyway, here's my comment on this:

2012/2/6 Farz Hem <fahhem2@gmail.com>:
> I thought of corrupting my tree root, but I ran "btrfs-debug-tree" and
> didn't see any tree root backups mentioned. On the youtube where Avi Miller
> mentioned it, he used "btrfs-debug-tree -R" but the version of btrfs-tools
> that I have available, as well as any I could compile from sources from the
> kernel wiki, didn't have a -R option. Either way, I'm not sure there is a
> root tree backup since I initially created the btrfs on a 3.0.0 kernel. I
> can run a 3.0.0 or 3.2.0 kernel on the new system as necessary.

I think Avi was using a pre-release version of the new btrfs-progs
from Chris which are soon to be released. I've watched that video,
too. But you are right, root tree backups are in btrfs only since 3.2
so if you never booted that kernel before purging the filesystem,
there are no backups.

> I'll try running photorec tomorrow, thanks for the pointer to that. Of
> course, a btrfs-specific way, such as using an older root tree, would be
> better since I'd get a higher signal-to-noise ratio on returned files.

I think photorec will expect the files to be continous so it will
probably return old versions of files (before COW'ed) or junk blocks
within the files. You should carefully check your important files
after finding them.

So in conclusion, photorec is probably your best chance (except trying
Josef's rescue uitility, see his btrfs-progs tree on Github[1]). The
rescue/restore utility is afair only in the unstable tree[2] which is
missing support for compression but you can copy that utility over to
the master tree without problems and modify the Makefile accordingly.

[1] https://github.com/josefbacik/btrfs-progs
[2] https://github.com/josefbacik/btrfs-progs/tree/unstable

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-06  8:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-06  3:41 Accidental formatting Fahrzin Hemmati
2012-02-06  7:40 ` Kai Krakow
     [not found]   ` <CAD8hrTPmcuac6wtJPR=pHES1gQJ2Q+ft8OmNOOKopMQKmV+8qA@mail.gmail.com>
2012-02-06  8:42     ` Kai Krakow

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).