btrfs vs filesystem problems/recovery tool

mount -o recovery /dev/btrfs /btrfs



device fsid b45b8c51-33eb-4ab0-9a33-4741cf8c6a6a devid 1 transid 18732 /dev/ubf6
btrfs: enabling auto recoveryparent transid verify failed on 57569280 wanted 18732 found 18734
parent transid verify failed on 57569280 wanted 18732 found 18734
parent transid verify failed on 57569280 wanted 18732 found 18734
parent transid verify failed on 57569280 wanted 18732 found 18734
parent transid verify failed on 57569280 wanted 18732 found 18734
parent transid verify failed on 57569280 wanted 18732 found 18734
parent transid verify failed on 9799873626169147392 wanted 9799873626169212927 found 0
------------[ cut here ]------------
kernel BUG at fs/btrfs/volumes.c:2860!
invalid opcode: 0000 [#1] SMP
CPU 1
Modules linked in: ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_conntrack nf_defrag_ipv4 veth ftdi_sio usbserial ext3 jbd isofs loop nls_iso8859_1 nls_cp437 vfat fat sg intel_agp intel_gtt radeon ttm drm_kms_helper drm i2c_algo_bit iptable_filter ip_tables ebtable_nat ebtables x_tables acpi_cpufreq mperf cpufreq_userspace cpufreq_stats cpufreq_powersave cpufreq_ondemand freq_table parport_pc ppdev lp parport bnep rfcomm binfmt_misc fuse tun nfs lockd fscache auth_rpcgss nfs_acl sunrpc bridge ipheth 8021q garp stp ext4 mbcache jbd2 zram(C) kvm_intel kvm snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec btusb snd_pcm_oss snd_mixer_oss snd_pcm bluetooth psmouse rfkill snd_timer i2c_i801 i7core_edac pcspkr i2c_core button snd edac_core processor soundcore rtc_cmos snd_page_alloc crc16 serio_raw evdev thermal_sys xfs btrfs zlib_deflate crc32c libcrc32c dm_mod raid1 md_mod sd_mod crc_t10dif usb_storage uas ub usbhid hid r8169 mii ahci libahci firewire_ohci libata firewire_core crc_itu_t scsi_mod ehci_hcd usbcore usb_common [last unloaded: scsi_wait_scan]

Pid: 18418, comm: mount Tainted: G         C   3.2.1 #1 Hewlett-Packard HP Elite 7000 Microtower PC/2A90h
RIP: 0010:[<ffffffffa0197fa7>]  [<ffffffffa0197fa7>] btrfs_num_copies+0x37/0x82 [btrfs]
RSP: 0018:ffff88006a2c3ac8  EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff8800ab266108 RCX: ffffffffffffffff
RDX: 00000078c9e30000 RSI: 880025241b880000 RDI: ffff88019742e1b8
RBP: ffff88006a2c3ae8 R08: 880025241b88ffff R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 880025241b880000
R13: 0000000000000000 R14: ffff88005d2b8a00 R15: 0000000000000000
FS:  00007f55305927e0(0000) GS:ffff88022fc40000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00002b0d47c59000 CR3: 00000001f0ab6000 CR4: 00000000000026e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process mount (pid: 18418, threadinfo ffff88006a2c2000, task ffff8802221cdbe0)
Stack:
 ffff880047a2e400 0000000000001000 ffff88005d2b89d8 ffff880047a2e400
 ffff88006a2c3b48 ffffffffa0175b2b 00000000000000ff 880025241b88ffff
 ffff88004e58e570 00000000ab266000 ffff880047a2e400 ffff88005d2b89d8
Call Trace:
 [<ffffffffa0175b2b>] btree_read_extent_buffer_pages+0x9d/0xbc [btrfs]
 [<ffffffffa01767b0>] read_tree_block+0x30/0x43 [btrfs]
 [<ffffffffa017a992>] open_ctree+0xf12/0x154c [btrfs]
 [<ffffffffa0160145>] btrfs_mount+0x3aa/0x565 [btrfs]
 [<ffffffff810cc527>] ? __free_pages+0x1b/0x24
 [<ffffffff810cc56f>] ? free_pages+0x3f/0x46
 [<ffffffff811853b4>] ? smack_sb_copy_data+0xf6/0x107
 [<ffffffff81112d8f>] mount_fs+0x6b/0x14f
 [<ffffffff810e1474>] ? __alloc_percpu+0xb/0xd
 [<ffffffff81127e21>] vfs_kern_mount+0x60/0x98
 [<ffffffff811291cd>] do_kern_mount+0x48/0xd8
 [<ffffffff81129940>] do_mount+0x6e3/0x746
 [<ffffffff810f6c25>] ? alloc_pages_current+0xaa/0xcd
 [<ffffffff81129a26>] sys_mount+0x83/0xbd
 [<ffffffff81337492>] system_call_fastpath+0x16/0x1b
Code: fb 48 83 ec 10 48 8d 7f 08 48 89 55 e8 e8 56 ea 19 e1 48 8b 55 e8 4c 89 e6 48 89 df e8 83 30 ff ff f0 48 ff 43 08 48 85 c0 75 04 <0f> 0b eb fe 48 8b 50 18 4c 39 e2 77 09 48 03 50 20 4c 39 e2 73
RIP  [<ffffffffa0197fa7>] btrfs_num_copies+0x37/0x82 [btrfs]
 RSP <ffff88006a2c3ac8>
---[ end trace ea074e24971fab1f ]---


./btrfsck  /dev/ubf6
parent transid verify failed on 58155008 wanted 18733 found 18661
parent transid verify failed on 58155008 wanted 18733 found 18661
parent transid verify failed on 58155008 wanted 18733 found 18661
parent transid verify failed on 58155008 wanted 18733 found 18661
Ignoring transid failure
leaf 58155008 items 6 free space 169 generation 18661 owner 7
fs uuid b45b8c51-33eb-4ab0-9a33-4741cf8c6a6a
chunk uuid ab8e0c05-f526-4614-a74e-59d6260a7a26
        item 0 key (EXTENT_CSUM EXTENT_CSUM 390792507392) itemoff 3839 itemsize 156
                extent csum item
        item 1 key (EXTENT_CSUM EXTENT_CSUM 390792667136) itemoff 3167 itemsize 672
                extent csum item
        item 2 key (EXTENT_CSUM EXTENT_CSUM 390793355264) itemoff 2431 itemsize 736
                extent csum item
        item 3 key (EXTENT_CSUM EXTENT_CSUM 390794108928) itemoff 1631 itemsize 800
                extent csum item
        item 4 key (EXTENT_CSUM EXTENT_CSUM 390794928128) itemoff 959 itemsize 672
                extent csum item
        item 5 key (EXTENT_CSUM EXTENT_CSUM 390795616256) itemoff 319 itemsize 640
                extent csum item
failed to find block number 74158080
Aborted

pokurcz:git/btrfs-recvo/recovery-beta# ./find-root  /dev/ubf6
Super think's the tree root is at 53374976, chunk root 20975616
Well block 4194304 seems great, but generation doesn't match, have=3, want=18734
Well block 4206592 seems great, but generation doesn't match, have=4, want=18734
Found tree root at 53374976


./btrfs-debug-tree -R /dev/ubf6
root tree: 53374976 level 0
chunk tree: 20975616 level 1
extent tree key (EXTENT_TREE ROOT_ITEM 0) 53465088 level 2
device tree key (DEV_TREE ROOT_ITEM 0) 26942234624 level 1
fs tree key (FS_TREE ROOT_ITEM 0) 74158080 level 2
checksum tree key (CSUM_TREE ROOT_ITEM 0) 447963000832 level 3
data reloc tree key (DATA_RELOC_TREE ROOT_ITEM 0) 29380608 level 0
btrfs root backup slot 0
        tree root gen 18732 block 57569280
                extent root gen 18732 block 74190848
                chunk root gen 8588 block 20975616
                device root gen 8588 block 26942234624
                csum root gen 18728 block 447963000832
                fs root gen 18732 block 74158080
                360809558016 used 520133771264 total 1 devices
btrfs root backup slot 1
        tree root gen 18733 block 57999360
                extent root gen 18733 block 58003456
                chunk root gen 8588 block 20975616
                device root gen 8588 block 26942234624
                csum root gen 18728 block 447963000832
                fs root gen 18732 block 74158080
                360809553920 used 520133771264 total 1 devices
btrfs root backup slot 2
        tree root gen 18734 block 53374976
                extent root gen 18734 block 53465088
                chunk root gen 8588 block 20975616
                device root gen 8588 block 26942234624
                csum root gen 18728 block 447963000832
                fs root gen 18732 block 74158080
                360809553920 used 520133771264 total 1 devices
btrfs root backup slot 3
        tree root gen 9799873626169212927 block 9799873626169147392
                extent root gen 0 block 0
                chunk root gen 65535 block 9800301589670461439
                device root gen 0 block 0
                csum root gen 0 block 0
                fs root gen 0 block 0
                9800432325723422720 used 0 total 9800432325698322431 devices
total bytes 520133771264
bytes used 360809553920
uuid b45b8c51-33eb-4ab0-9a33-4741cf8c6a6a
Btrfs Btrfs v0.19

Read-only recovery works (as of 2012.02):

time nice ionice -c 3 ./restore -v /dev/btrfs /fs/recovery
Root objectid is 5
Restoring /fs/recovery/home.2011.01.19.tar.lzma
Restoring /fs/recovery/venom
Restoring /fs/recovery/venom/fs.tar.lzop
We seem to be looping a lot on /fs/recovery/venom/fs.tar.lzop, do you want to keep going on ? (y/N): y
We seem to be looping a lot on /fs/recovery/venom/fs.tar.lzop, do you want to keep going on ? (y/N):
Done searching /fs/recovery/venom
Restoring /fs/recovery/out
Restoring /fs/recovery/out/copy
Done searching /fs/recovery/out/copy
Restoring /fs/recovery/out/pdf

...



real    647m2.091s
user    0m0.800s
sys     30m3.790s

( 309G of data recovered from failed btrfs in 10 hours )

| btrfs vs filesystem problems/recovery tool | | 2012.02.08-10:23.00

 Q: How do you catch a unique rabbit? A: Unique up on it! Q: How do you catch a tame rabbit? A: The tame way!