Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: hennessyhemp on April 08, 2013, 03:17:08 AM



Title: Please help! My wallets are trapped on a corrupt HDD!
Post by: hennessyhemp on April 08, 2013, 03:17:08 AM
 ??? My Bitcoin & Litecoin wallets (which I was attempting to backup) have been trapped on my HDD!

I was running linux ubuntu 12.10, and started getting an error message with a red alert message, so I was trying to figure out
how to backup my wallets when the computer froze.  I rebooted and it started hanging at boot.  I took out the
drive and attempted to connect it to my desktop to see if I could recover the files, only to discover that it was
not displaying the entire drive (it's 500gb and it displayed only 250).  It seems like the drive may have a bad
sector or something, and my wallets and private keys are stored on there alone, there were no other backups successfully
made (in truth I hadn't found the damned file I was supposed to backup because I'm still unfamiliar with linux).

I don't trust Best Buy or even local computer shops that don't know about Bitcoin, anyone know of anything I might try?
I would prefer a professional take a look as I don't want to do anything that might further damage the data, but a professional
that understands bitcoin and has a reputation of not screwing people.





Title: Re: Please help! My wallets are trapped on a corrupt HDD!
Post by: caiaphas on April 08, 2013, 03:55:56 AM
Assuming you have only one computer, I'd remove the HD.  Replace it with a new HD and install Ubuntu again.  Now hook up the failing drive as a slave.  After you boot off the new Ubuntu installation, attempt to mount the slave drive's partition that used to hold your wallet under something like /mnt/recover

i.e.

sudo mkdir /mnt/recover
sudo mount -t ext4 /dev/sdb1 /mnt/recover

The parameters will depend on the file system type, drive letter of the slave (bad) drive and partition number.

(You could probably also just boot off of an Ubuntu 12.10 installation CD and then press Cntrl-Alt-F1 to get to a shell.  It's possible to do the above without installing Ubuntu again but since you're going to do it anyway, I'd just install fresh onto a new HD)

If the drive isn't too far gone, you may be able to navigate to the .bitcoin dir in your old home folder and recover the wallet.dat file.

If you don't remember which partition your home dir was on, you can use fdisk to see what's available and just try to mount them all to different dirs you create under /mnt

i.e.

sudo fdisk /dev/sdb
p <enter>

/dev/sda1   *        2048     1953791      975872   83  Linux
/dev/sda2         1953792   158318591    78182400   83  Linux
/dev/sda3       158318592   482537471   162109440   83  Linux
/dev/sda4       482537472   488396799     2929664   82  Linux swap / Solaris

For example, my /home partition is /dev/sda3

If you get failures attempting to mount partitions, you can try sending the raw drive bytes over to a file on your new HD.

i.e.
dd if=/dev/sdb -of /tmp/recover.img

It might be possible to sift through the data to find the wallet.dat header and then your private keys within it (unless it was encrypted)




Title: Re: Please help! My wallets are trapped on a corrupt HDD!
Post by: hennessyhemp on April 08, 2013, 04:14:34 AM
Ok, insofar as I did not encrypt, I really like what you're saying, though I really don't trust myself fully just yet to
do that...might know of a linux wiz that can help though, and I'll certainly show them this thread.  I'm really liking the
idea that even if it's corrupt there's a chance for recovery through the backup image.  My buddy was reassuring me, saying
he really doesn't think I have anything to worry about, the drive still works and shows some files...though it does seem to be
registering some part of it as bad sectors.  For now, I'll keep the drive non-op until I can get an expert to help me.

Obviously, I'll be taking many many more precautions next time...but at least there's a light at the end of this tunnel now, thanks...if
I recover this, you'll have to post an LTC address I can donate to.


Title: Re: Please help! My wallets are trapped on a corrupt HDD!
Post by: jackjack on April 08, 2013, 06:52:46 AM
You can use pywallet to try to recover your coins, it has an option to read bytes of a partition and find key headers inside it


Title: Re: Please help! My wallets are trapped on a corrupt HDD!
Post by: hennessyhemp on April 08, 2013, 03:01:44 PM
Jah-Pastafari! 

I'm going to have to find a pro with the equipment to mirror this drive before I go any further, then I'll copy that to run this utility...Thank You!


Title: Re: Please help! My wallets are trapped on a corrupt HDD!
Post by: bitbadger on April 08, 2013, 07:06:11 PM
Assuming you have only one computer, I'd remove the HD.  Replace it with a new HD and install Ubuntu again.  Now hook up the failing drive as a slave.  After you boot off the new Ubuntu installation, attempt to mount the slave drive's partition that used to hold your wallet under something like /mnt/recover

.. .. .. ..

If you get failures attempting to mount partitions, you can try sending the raw drive bytes over to a file on your new HD.

i.e.
dd if=/dev/sdb -of /tmp/recover.img

It might be possible to sift through the data to find the wallet.dat header and then your private keys within it (unless it was encrypted)

good advice from caiaphas. Just make sure if you do do a ubuntu reinstall that you physically remove the HDD before you do it, or at least be very careful not to format it during install (under linux formatting means creating a new file system on it - you do NOT want to do this), or you risk losing the data completely. And don't do any re-partitioning or new partitioning of it either.

the dd command is also a good idea in any case.

another thing you can try is a data recovery utility called TeskDisk.  its free open source, I havent used it myself but Ive heard good reports about it.

might also be a possibility.

see http://www.cgsecurity.org/wiki/TestDisk  

good luck!


Title: Re: Please help! My wallets are trapped on a corrupt HDD!
Post by: dethdeks on April 08, 2013, 07:11:46 PM
why not leave the drive in the system and boot to live cd of ubuntu then see if the disk mounts and then retrieve the file to a usb key


Title: Re: Please help! My wallets are trapped on a corrupt HDD!
Post by: theGECK on April 08, 2013, 07:40:30 PM
why not leave the drive in the system and boot to live cd of ubuntu then see if the disk mounts and then retrieve the file to a usb key

I'd try this first. Also, have you tried SpinRite (www.grc.com/spinrite.htm). It's recovered more than one HDD for me - assuming that the drive itself isn't physically damaged.


Title: Re: Please help! My wallets are trapped on a corrupt HDD!
Post by: Richy_T on April 08, 2013, 07:47:14 PM
How many bitcoins? If it's not many, just put the drive to one side and wait until it's worth recovering. If it's a lot, you probably want to go ahead and pay someone (but you would have had a backup in that case anyway, right?)