Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recon command crashes on slice out of range #2

Closed
5ay3h opened this issue Jun 29, 2018 · 17 comments
Closed

recon command crashes on slice out of range #2

5ay3h opened this issue Jun 29, 2018 · 17 comments
Assignees
Labels

Comments

@5ay3h
Copy link

5ay3h commented Jun 29, 2018

Hi @cblichmann !

I am trying to use your tool to restore a "lost cause" BTRFS partition.
I'm getting this crash while running the command recon on the image:

# identify
root@lubuntu:/tmp# /root/go/bin/btrfscue identify /mnt/wd/Backup/dell_dd/sda5_dd.img 
 2012 / 2013 [==========================================================================================]  99.95% 13s
fsid                                 count entropy  block size
91dea238-022f-4014-8863-f96ec0c657f9 42    3.875000 16384
00000000-0000-00b2-0500-000000000000 7     0.668564 0
d2b16853-89e0-4324-bd66-015325e8d48e 5     3.875000 16384
# recon
root@lubuntu:/tmp# /root/go/bin/btrfscue recon --id 91dea238-022f-4014-8863-f96ec0c657f9 --metadata metadata.91dea238-022f-4014-8863-f96ec0c657f9.1.2.db /mnt/wd/Backup/dell_dd/sda5_dd.img 
 36.27 MB / 76.80 GB [>----------------------------------------------------------------------------------]   0.05% 1s
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
blichmann.eu/code/btrfscue/btrfs.Leaf.Data(0xc4200a4000, 0x1000, 0x1000, 0x0, 0x1000, 0x2444000, 0x1000)
	/root/go/src/blichmann.eu/code/btrfscue/btrfs/leaf.go:123 +0xc6
main.(*reconCommand).Run(0xc42000a3c0, 0xc42000e140, 0x1, 0x1)
	/root/go/src/blichmann.eu/code/btrfscue/recon.go:120 +0x75e
blichmann.eu/code/btrfscue/subcommand.(*CommandSet).Run(0xc420052050, 0xc42000e140, 0x1, 0x1)
	/root/go/src/blichmann.eu/code/btrfscue/subcommand/subcommand.go:147 +0x52
blichmann.eu/code/btrfscue/subcommand.Run()
	/root/go/src/blichmann.eu/code/btrfscue/subcommand/subcommand.go:173 +0x48
main.main()
	/root/go/src/blichmann.eu/code/btrfscue/btrfscue.go:122 +0x18c

I'm not sure why this happens...
I will try to make the slice functionality (Data extraction) safer, but I don't think it's the cause of the real issue here?

LMK if there is more data I can provide.
Thanks :)

@cblichmann
Copy link
Owner

Hi @5ay3h,
Thanks for the report. It has been a while since I touched the project (lack of time, sadly). I will take a look at this, haven't seen this so far (maybe tomorrow evening CEST).
Cheers, Christian

@cblichmann cblichmann self-assigned this Jul 1, 2018
@cblichmann cblichmann added the bug label Jul 2, 2018
@L3P3
Copy link

L3P3 commented Aug 16, 2018

A shame the very same error still appears with the latest version.
I have no idea if that tool would have helped me recovering a few files anyway. If I knew it will, I would pay for it...

@cblichmann
Copy link
Owner

Yeah, I didn't have any spare time to work on this yet. I advice you to keep an image of the drive on file (no pun intended), so you can try with a future version.
Don't worry about paying anyone, this tool is supposed to remain free :)

@hartmark
Copy link

+1 have same problem

@cblichmann
Copy link
Owner

Care to try again? The latest commits should (fingers crossed) fix one such issue.

@hartmark
Copy link

Good job! Sadly I have already begun full wipe off the affected discs before sending them to a friend. I'll keep in mind to try the unfixed version of I need to try recover in the future to see if it's fixed.

@5ay3h
Copy link
Author

5ay3h commented Dec 20, 2018 via email

@cblichmann
Copy link
Owner

Ok, pinging again later. If you try it out, you can use the mount to mount a read-only view of your damaged filesystem using FUSE.
That makes it convenient to assess the potential for data recovery.

@hartmark
Copy link

hartmark commented Jan 4, 2019 via email

@cblichmann
Copy link
Owner

Hmm, that's odd, I just tried this and it worked:

$ git clone --recurse-submodules https://github.com/cblichmann/btrfscue.git .
$ make
  [Build]     /home/cblichmann/devel/btrfscue/bin/btrfscue

@hartmark
Copy link

hartmark commented Jan 6, 2019

strange, I removed and started over one more time and now it compiles perfectly again. I'll try again now with the recon and see if it works better now with my second failed btrfs disk set :/

@hartmark
Copy link

hartmark commented Jan 7, 2019

I just tried it out and it seems to fail with same error:

1 markus@staropramen ~/btrfscue/bin (git)-[master] % sudo ./btrfscue identify /dev/sda
[sudo] password for markus:
 5455 / 97675 [==>--------------------------------------------------]   5.58% 11 63 6939 / 97675 [===>------------------------------------------------]   7.10%
 97675 / 97675 [================================================] 100.00% 12m34s
fsid                                 count entropy  block size                 
1fbb3b74-20d8-4c5c-9302-db5e6dfbd21b 45    4.000000 16384                      
a13d8d31-f12f-448f-b63c-9d44c29d1042 17    3.750000 16384                      
01000000-0200-0000-0100-000002000000 7     1.061278 0                          
sudo ./btrfscue identify /dev/sda  1.91s user 7.86s system 1% cpu 12:39.66 total

1 markus@staropramen ~/btrfscue/bin (git)-[master] % sudo ./btrfscue recon --id
1fbb3b74-20d8-4c5c-9302-db5e6dfbd21b --metadata metadata_sda.db /dev/sda       
 2.00 GB / 3.64 TB [>----------------------------------------------]   0.05% 11s
panic: runtime error: slice bounds out of range                                

goroutine 1 [running]:
blichmann.eu/code/btrfscue/btrfs.Leaf.Data(0xc0000c4000, 0x1000, 0x1000, 0x0, 0xfffffffffffffff6, 0x80114080, 0x70890a6000)                                    
        /home/markus/btrfscue/src/blichmann.eu/code/btrfscue/btrfs/leaf.go:129 +0xf6
main.(*reconCommand).Run(0xc0000b0020, 0xc00008a060, 0x1, 0x1)                 
        /home/markus/btrfscue/src/blichmann.eu/code/btrfscue/recon.go:120 +0x598
blichmann.eu/code/btrfscue/subcommand.(*CommandSet).Run(0xc000094000, 0xc00008a060, 0x1, 0x1)
        /home/markus/btrfscue/src/blichmann.eu/code/btrfscue/subcommand/subcommand.go:147 +0x52
blichmann.eu/code/btrfscue/subcommand.Run()                                    
        /home/markus/btrfscue/src/blichmann.eu/code/btrfscue/subcommand/subcommand.go:173 +0x48
main.main()
        /home/markus/btrfscue/src/blichmann.eu/code/btrfscue/btrfscue.go:123 +0x174

@cblichmann
Copy link
Owner

After playing around with newer BTRFS images, I have a test case that reproduces this now.

@hartmark
Copy link

hartmark commented Jan 7, 2019 via email

@cblichmann
Copy link
Owner

I haven't gotten around to actually implement the extend mapping (see issue #4), so for your block size (16KiB), you can restore files of up to ~15KiB in size. I know that this is not too useful yet, but I do have some experimental code lying around that deals with the full file extent data and have already used it to restore a few files I cared about from another "hopeless" image :) -- If #4 is done, you'll be able to restore files of any size.
The cool thing about the metadata index this tool uses, is that it should also be able to "undelete" files from a live disk. In limited cases, it's even possible to go back in time and view the whole disk at an earlier stage.

@hartmark
Copy link

hartmark commented Jan 7, 2019

Alright, I have backups on my most important data but there are some Plex server settings files I want to find so I don't have to redo my setup.

Do you have a branch with the test code for #4 ? Restoring bigger files are indeed an interesting feature. Have you poked the btrfs mailing list for any assistance on getting it running?

Perhaps the official recover program can be called with some parameters to avoid duplication of effort.

Being able to undelete files can Indeed be a really cool feature.

I have a raid1 with three discs, 4GiB, 3GiB, and 1GiB respectively. It would be neat to be able to use metadata from all discs if one copy is defective.

@5ay3h
Copy link
Author

5ay3h commented Feb 16, 2019

@cblichmann

It works !
(Sorry for the long delay.)

GJ mate 👍

now if we will just be able to recover all the files (with metadata), we could finally open the champagnes 😄

@5ay3h 5ay3h closed this as completed Feb 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants