Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Mashrock on July 05, 2012, 07:40:53 AM



Title: Formatted computer lost coins?
Post by: Mashrock on July 05, 2012, 07:40:53 AM
I am stupid and forgot about my coins on my computer. i have formatted and now i think my coins are gone? is there any way i can recover my wallet.dat file? if thats the file i am after?

is there any way i can get them back at all? i am using a Mac, with fresh install of osx 10.7


Title: Re: Formatted computer lost coins?
Post by: Revalin on July 05, 2012, 08:09:48 AM
Yes.  TURN THE COMPUTER OFF IMMEDIATELY.  Don't shut it down or anything, just pull the plug.

There is a utility that scan scan the whole hard drive for lost wallets.  I will get you more info in a moment.


Title: Re: Formatted computer lost coins?
Post by: Revalin on July 05, 2012, 08:21:36 AM
Info on recovery utility here:  https://bitcointalk.org/index.php?topic=25091.0

You will need to burn a Linux boot disc using another computer.  SystemRescueCD is a good choice.  Put it in the mac, hold down the C key, power on, then release it when it starts to boot.

The thread has instructions on how to perform the recovery.  If you're not familiar with using Linux (let alone the command line) then you'll probably find it a bit confusing.  We'll help you through it.


Title: Re: Formatted computer lost coins?
Post by: Mashrock on July 05, 2012, 10:42:08 AM
I'm sure this will help.

i have the hard drive out of the computer. plugged into a usb adapter and powered on connected to another mac i have..

just reading that thread now cheers.


Title: Re: Formatted computer lost coins?
Post by: nayrB16 on July 05, 2012, 01:12:05 PM
Goodluck, let me know how it goes.


Title: Re: Formatted computer lost coins?
Post by: Mashrock on July 05, 2012, 11:12:12 PM
Still going along with it.... had to use one of my mining rigs, to get it working and in the process now! for about the 3rd time. macbooks dont like to boot from usb with linux no more..

bout 40% the way thru but its still showing no keys found.

the drive was almost at capacity when i formatted it with the bitcoin wallet a new addition (hence why i just forgot about it) all i did was format and install a fresh os on it. so heres hoping that it can be recovered.

i did try a few other disk recovery tools but were all pretty shit.


Title: Re: Formatted computer lost coins?
Post by: dreamwatcher on July 05, 2012, 11:27:15 PM
You could try Parted Magic, a cd/usb based Linux distro designed around drive operations/data recovery etc.

http://partedmagic.com/doku.php

It is free, so it is worth a shot.

There are a few data recovery programs in the distro. In my experience, the best ones are command line based, so be prepared to dive into that dark world  ;)


Title: Re: Formatted computer lost coins?
Post by: Mashrock on July 06, 2012, 12:13:24 AM
So i have completed the program linked up above by Revalin but it recovered nothing at all...

am i doomed or what? there is a considerable amount of coins here pretty much all my mining efforts gone..

i do have some of the publc keys i used to transfer the coins to this wallet.


Title: Re: Formatted computer lost coins?
Post by: REF on July 06, 2012, 01:59:18 AM
The coins are gone unless you can get the private keys in the wallet. The public keys are only going to let you know how many coins you have.

I have seen in the past some reputable members try to recover coins for members if you shipped them your hard drive. I guess it would be a bit of a pain because its a mac so unless your comfortable taking it apart to get the HDD you would need to ship the entire unit. It sounds as if that computer is for everyday use too so im not sure if you could do without it. It still may be a better option then losing all your coins. I forget who offered the service in the past. :\


Title: Re: Formatted computer lost coins?
Post by: Revalin on July 06, 2012, 03:24:41 AM
Was the wallet encrypted?  There's a note on that thread that the tool doesn't work with encrypted wallets.  If it was using the encrypted format then we may have to modify it a bit.


Title: Re: Formatted computer lost coins?
Post by: Mashrock on July 06, 2012, 07:02:53 AM
I got a few computers, the drives is out and connected up to a linux machine which i ran them programs and found nothing. however using hex editor/search i can find instances of 0420 so maybe all isnt lost. casascius is going to work on it next week for me so with a bit of luck there is something still there.

mac windows etc.. its all the same when your looking at it this way..


Title: Re: Formatted computer lost coins?
Post by: Stephen Gornick on July 07, 2012, 12:59:17 AM
Was the wallet encrypted?  There's a note on that thread that the tool doesn't work with encrypted wallets.  If it was using the encrypted format then we may have to modify it a bit.

Also I see v0.3 which supports compressed public keys was just released, so if your scan was done with a version prior to 0.3, it wouldn't have detected anything if you are running Bitcoin v0.6.x, which uses compressed public keys.


Title: Re: Formatted computer lost coins?
Post by: deepceleron on July 07, 2012, 02:31:12 PM
The key phrase in the first post is "fresh install", that the OS was reinstalled and used after the formatting too, drastically reducing the chance of recoverable data remaining in unwritten areas.

If you do a quick format, which takes just a few seconds, then the majority of the data areas may still have been intact (until the reinstallation of another OS). If however a full format was done (10 minutes to several hours depending on the drive size and tech), this writes zeroes to all data areas of the hard drive, removing the option of recovery. This depends on how the OSX formatter's (appropriately called "erase disk") security option was set:

http://www.kenstone6.net/fcp_homepage/images_partitioning_tiger/00_partitioning_tiger.jpg


Title: Re: Formatted computer lost coins?
Post by: deus-ex-machina on July 08, 2012, 05:04:10 PM
A piece of advice (this won't help now, but it will later):

When you have a wallet, make physical QR codes of the public addresses AND private keys. Match them as well. Multiple copies of the keys in case one is damaged or lost. Then you can scan the code with your webcam (yes, tools exist that do that) and recover them. This has not been tested on encrypted wallets, but probably won't work on them.


Title: Re: Formatted computer lost coins?
Post by: Jutarul on July 08, 2012, 05:54:41 PM
to gain a bit more confidence on the restorability of the data you could do a deep scan for each one of the public keys. I appended a  bash script which does that for you. You need to modify the pubkey variable and redirect dd to the correct hard disc. the loop assumes that your hard disc is less than 2TB. Also, make sure you have root access to the drive...

If you find one public key on the disc that might be an indication that the restoration tool has failed you but the data is still there.

I don't know how much you know about data restoration but it may pay off to find someone to do it for you.
All depends on trust level and whether the amount is worth it....

good luck!

script:
===
#!/bin/bash

pubkey=1Nn3GoGpWj3UonxUq4VB432T8fxnBmec2b

for i in {0..2000000}; do
 dd if=/dev/sda2 of=block.dat bs=1M count=2 skip=$i &>/dev/null
 grep $pubkey block.dat &>/dev/null
 if [ $? -eq 0 ] ; then
  echo "public key found, block $i"
  break
 fi
done


Title: Re: Formatted computer lost coins?
Post by: DannyHamilton on July 09, 2012, 03:04:06 AM
. . .When you have a wallet, make physical QR codes of the . . . private keys. . .
Perhaps you can offer some instruction on how to do this for those non-technical people who are using the standard bitcoin client?  It doesn't offer any buttons or menu options to do this, or even to see what your private key is.


Title: Re: Formatted computer lost coins?
Post by: Mashrock on July 09, 2012, 05:45:54 AM
Hey guys thanks for the extra help and advice here, i am just running .3 now after being away all weekend.

i know a little about data recovery but have never really dove this far into it before.

i dont think i zero'd out data on the format, just did a quick format.

if this .3 tool fails to recover again i will be talking to cassicaus , and perhaps trying the quick script above.

but in the end if its gone i guess its gone :(


Title: Re: Formatted computer lost coins?
Post by: Stephen Gornick on July 09, 2012, 05:55:59 AM
i am just running .3 now after being away all weekend.

This is still a crucial detail:

Was the wallet encrypted?  There's a note on that thread that the tool doesn't work with encrypted wallets.  If it was using the encrypted format then we may have to modify it a bit.


Title: Re: Formatted computer lost coins?
Post by: Mashrock on July 09, 2012, 07:34:42 AM
Nope i thought i mentioned it wasnt encrypted..

anyway its now done, 110 keys found.. however in ubuntu i am having troubles copying the file that has been made.

it has a lock on it and i cant copy move or anything with this file.

i am using ubuntu desktop off a usb stick so its not installed? i have not created a persistent drive with this install also.. so when i restart the computer i am back to square one..

so i am running this again to get the 110 keys once more and will leave the computer on

can someone help me with this step?? seems to me like file permissions? says its owned by root?


Title: Re: Formatted computer lost coins?
Post by: Revalin on July 09, 2012, 07:50:17 AM
Do you have another USB stick?  If so just put it in and then:

Find the USB stick's name:
ls /media

Copy the recovered wallet there:
cp new_wallet.db /media/usb_stick_name/


Title: Re: Formatted computer lost coins?
Post by: Mashrock on July 09, 2012, 08:54:42 AM
permissions denied to open/copy that file still?


Title: Re: Formatted computer lost coins?
Post by: Revalin on July 09, 2012, 08:55:50 AM
sudo cp new_wallet.db /media/usb_stick_name/


Title: Re: Formatted computer lost coins?
Post by: Mashrock on July 09, 2012, 09:21:59 AM
beautiful.. thankyou so much..

whats your bitcoin address..

as soon as i can transfer them i will send you some too. along with the creator of that program if he ever sends me his address..

where would the wallet.dat file be located on my linux desktop usb?? is it called wallet.cpp or wallet.h on linux?


Title: Re: Formatted computer lost coins?
Post by: Revalin on July 09, 2012, 09:38:24 AM
Makomk deserves most of the love, but if there's any left over you can send it to 165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g .  :)

.cpp and .h are C source code.  Your wallet should just be called wallet.dat.  It will usually be in /home/<username>/.bitcoin .


Title: Re: Formatted computer lost coins?
Post by: Raoul Duke on July 09, 2012, 09:43:31 AM
Makomk deserves most of the love, but if there's any left over you can send it to 165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g .  :)

.cpp and .h are C source code.  Your wallet should just be called wallet.dat.  It will usually be in /home/<username>/.bitcoin .

Just to add a little detail. If you can't find the .bitcoin directory on your home dir press CTRL+H to unhide it ;)


Title: Re: Formatted computer lost coins?
Post by: Revalin on July 10, 2012, 02:53:57 AM
Good to hear it worked out!  Always glad to help.

Yes, always wipe your hard drives...  AFTER you save your BTC.  :)


Title: Re: Formatted computer lost coins?
Post by: vokain on July 10, 2012, 03:56:05 AM
haha that was a fat wallet! glad you got your coins back instead of losing them forever the the aether :)


Title: Re: Formatted computer lost coins?
Post by: Mashrock on July 10, 2012, 04:16:04 AM
Oh yes, a bit of coin trading, and about two years of mining @ 2gh/s.

i turned all the rigs off now however, electricity was killing me and was pretty much break even.

now i have the coins back i can start trading a little again.. should sell my 5970's and pay the electricity bill too


Title: Re: Formatted computer lost coins?
Post by: makomk on July 10, 2012, 09:12:26 PM
All payments sent :) thankyou all so much for all your help!!

i definitely wont be so careless next time! however another lesson learnt on how much shit is left on your computer after a format, and thank god for that.... this time anyway..
Yeah, I noticed your payment to me this morning - thanks! Glad to hear that it all worked out in the end and you managed to get your bitcoins back!


Title: Re: Formatted computer lost coins?
Post by: Ferroh on July 12, 2012, 11:53:26 AM
this writes zeroes to all data areas of the hard drive, removing the option of recovery

A zero fill does not generally remove the option of recovery on spinning disks (if you only zero fill once). I'm not sure about SSDs, but it probably doesn't remove the option on those either.


Title: Re: Formatted computer lost coins?
Post by: Revalin on July 12, 2012, 11:57:57 AM
A zero wipe changes it from "here run this utility" to requiring an electron microscope to maybe POSSIBLY recover something (at modern drive densities it's debatable whether it's possible at all).  That's close enough for most people.