[Btrfs-devel] reversing the effects of mkfs.btrfs?

Peter Teoh htmldeveloper at gmail.com
Sun Apr 27 07:11:07 PDT 2008


Ok, I have done some experiments:

:-( :-( :-( :-( :-( :-( :-( :-( :-( :-( :-( :-( :-( :-( :-( :-(
This is no good.

I did some test on a 100M partition.

1.   create/mount a ext3 fs.
2.   create 50 identical files (with random contents inside).
3.   dismount it.
4.   do a dd backup of the image.
5.   execute mkfs.btrfs on it.
6.   do a dd backup of the image.
7.   compare incrementally the hexadecimal output of the two dd image above.

The results?   Disaster, lots of binary diff.   Starting with 0x400 offset:

 00003f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
-0000400: 00f0 0100 bcb8 0700 d662 0000 fa87 0600  .........b......
-0000410: c3ef 0100 0100 0000 0000 0000 0000 0000  ................
-0000420: 0020 0000 0020 0000 0008 0000 5a82 1448  . ... ......Z..H
-0000430: 7582 1448 0100 2500 53ef 0100 0100 0000  u..H..%.S.......
-0000440: 4782 1448 004e ed00 0000 0000 0100 0000  G..H.N..........
-0000450: 0000 0000 0b00 0000 8000 0000 3400 0000  ............4...
-0000460: 0200 0000 0100 0000 5c0c 3e5c dbf4 4793  ........\.>\..G.
-0000470: 8358 1077 d099 19c6 0000 0000 0000 0000  .X.w............
+0000400: 0000 0000 0000 0000 0000 0000 0000 0000  ................
+0000410: 0000 0000 0000 0000 0000 0000 0000 0000  ................
+0000420: 0000 0000 0000 0000 0000 0000 0000 0000  ................
+0000430: 0000 0000 0000 0000 0000 0000 0000 0000  ................

and the difference continues nonstop, just another intermediate example:

-0149000: 2505 0000 2605 0000 2705 0000 2805 0000  %...&...'...(...
-0149010: 2905 0000 2a05 0000 2b05 0000 2c05 0000  )...*...+...,...
-0149020: 2d05 0000 2e05 0000 2f05 0000 3005 0000  -......./...0...
-0149030: 3105 0000 3205 0000 3305 0000 3405 0000  1...2...3...4...
-0149040: 3505 0000 3605 0000 3705 0000 3805 0000  5...6...7...8...
.....................
+0149000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
+0149010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
+0149020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
+0149030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
+0149040: 0000 0000 0000 0000 0000 0000 0000 0000  ..........

Generally the pattern can be seen to be zeroizing lots of original
non-zero data.

Effectively, the mkfs.btrfs did destroyed LOTS of information.

Doing a mkfs.ext3 after the mkfs.btrs does not restore back any
information, if not destroying even more information.

Ok....my 40GB of few years of work is gone.....backup?  well....i
have....it is in my head....:-(.

On Fri, Apr 25, 2008 at 3:36 PM, Peter Teoh <htmldeveloper at gmail.com> wrote:
> thanks for the tip.   i will do  a dd to back up first, probably
> tomorrow.   thanks!!!
> On Fri, Apr 25, 2008 at 3:34 PM, Yan Zheng <yanzheng at 21cn.com> wrote:
> > 2008/4/25, Peter Teoh <htmldeveloper at gmail.com>:
> >
> > > I was playing  around with btrfs, and did a  mkfs.btrfs on one of my
> >  > partition.   Mistakes, it was my data partition (ext3 based).
> >  >
> >  > I have not yet mounted the device, but the mkfs.btrfs continued to
> >  > completion.
> >  >
> >  > Is it possible to salvage my ext3 filesystem?   Anyway to reverse the
> >  > effect of mkfs.btrfs?
> >  >
> >
> >  Try fsck.ext3, but at your risk. (mkfs.btrfs only overwrites a few
> >  blocks at beginning of device)
> >
> >  Good Luck
> >  YZ

-- 
Regards,
Peter Teoh



More information about the Btrfs-devel mailing list