Friday, July 22, 2011

Fixing SD card corrupted

Note: I didn't recover the file, so, this is just for my documentation... No solution in here :(

So, my key file on the SDHC card is corrupted. When I try to copy it I get an error saying: "the file or directory is corrupted and unreadable". It is an Excel file, so, when I try to open it, I get "the file may be read-only, or you may be trying...". Whatever.

I run chkdsk and get: dadada file "is cross-linked on allocation unit" da da da, "cross link resolved by copying". It asks me if to convert or not lost chains. I say Yes, it says it did, but I can't really find the 344064 bytes that he claims to have saved in a file. Not sure where he put it. I can't find it either in the root directory ?!? And still can't open the file...
So, the digging starts... Checking the drive in my computer I can see that it is a 3.75GB. I can also see that I bought it at MicroCenter. Then I found this link:
http://usbspeed.nirsoft.net/?g=4gb
Which says:
Product NameVendor NameDrive SizeVIDPIDRead SpeedWrite SpeedSubmitter
Micro Center 4GB USB Flash (New 2010 Case)A-DATA Technology Co., Ltd.3.75 GB125f016.55 MB/Sec3.14 MB/Secjeffd

Isn't the web nice! Thank you guys! By the way, notice that 3.75 x 1,073,741,824 = 4026531840 bytes. I guess that's why they call it 4GB. C'mon!! Anyhow, back to the error.


You can read here http://technet.microsoft.com/en-us/library/cc975110.aspx a small explanation on what cross-link means. Not that it helps, but...

The next thing I want to try, before attempting any fixes is to save an image of the SD card somewhere. Not easy to find a freaking software that does that, but then I found the dd command in Linux. And as I have no Linux around, I found that there is a version of it for Windows: http://www.chrysocome.net/dd. AWESOME!
Open a DOS command window where the dd.exe is sitting and execute dd --list which will give us a list of all drives (here is what I got on mine):

C:\Program Files\dd>dd --list
rawwrite dd for windows version 0.6beta3.
Written by John Newbigin <jn@it.swin.edu.au>
This program is covered by terms of the GPL Version 2.

Win32 Available Volume Information
\\.\Volume{b911133a-fbd0-11dd-b92c-806d6172696f}\
  link to \\?\Device\HarddiskVolume1
  fixed media
  Mounted on \\.\f:

\\.\Volume{b911133b-fbd0-11dd-b92c-806d6172696f}\
  link to \\?\Device\HarddiskVolume2
  fixed media
  Mounted on \\.\c:

\\.\Volume{b911133c-fbd0-11dd-b92c-806d6172696f}\
  link to \\?\Device\HarddiskVolume3
  fixed media
  Mounted on \\.\g:

\\.\Volume{07c70281-38e5-11da-8c54-806d6172696f}\
  link to \\?\Device\CdRom0
  CD-ROM
  Mounted on \\.\d:

\\.\Volume{49dbb16c-2dc1-11e0-ba0d-0014a431fb0f}\
  link to \\?\Device\Harddisk1\SP0
  removeable media
  Mounted on \\.\e:


NT Block Device Objects
\\?\Device\CdRom0
  size is 2147483647 bytes
\\?\Device\Harddisk0\Partition0
  link to \\?\Device\Harddisk0\DR0
\\?\Device\Harddisk0\Partition1
  link to \\?\Device\HarddiskVolume1
  Fixed hard disk media. Block size = 512
  size is 65769984 bytes
\\?\Device\Harddisk0\Partition2
  link to \\?\Device\HarddiskVolume2
\\?\Device\Harddisk0\Partition3
  link to \\?\Device\HarddiskVolume3
  Fixed hard disk media. Block size = 512
  size is 3561546240 bytes

Virtual input devices
 /dev/zero   (null data)
 /dev/random (pseudo-random data)
 -           (standard input)

Virtual output devices
 -           (standard output)
 /dev/null   (discard the data)

One can see the 3 partitions of my HDD, the CD-ROM and the SD card, in e: !! (I know that because anyhow, it appears as e: on my Windows).

Now that I know the drive, I am going to try to create the image:
C:\Program Files\dd>dd if=\\.\e: of=c:\sd.img bs=1M --size --progress
rawwrite dd for windows version 0.6beta3.
Written by John Newbigin <jn@it.swin.edu.au>
This program is covered by terms of the GPL Version 2.

3,850M
3850+0 records in
3850+0 records out

I do it with blocks of 1M (recommended), so, it takes about 5 minutes and done! Now that I got the image, I want to recover the file. Ideally would like to work on the image, not the original, but do not know how to do that. So, I'll trust I have the image and will mess with the SD card directly.

I tried all kind of stuff but didn't work... :(

Testdisk seemed powerful but I only saw that it can do an image. Didn't see that it can help me recovering my file...:
http://www.cgsecurity.org/wiki/TestDisk_Download

Got this one that is supposed to help you get the files you want out of the disc, but didn't seem to work?!?
http://www.powerdatarecovery.com/power-data-recovery.html

Recuva gets to the point of listing the file, but says that 85 clusters are written on top by some other program... Trying to recover it with it gives me a bunch of garbage.
http://www.piriform.com/recuva/download

Also tried this but didn't go very far. Seems limited to 1GB so, didn't get to see anything:
http://www.easeus.com/datarecoverywizard/free-data-recovery-software.htm

Got the Zero Assumption Disk Space Visualizer. Nice to check the disk:
http://www.z-a-recovery.com/download.htm
From the same link, we got too ZAR9. Looks very nice and powerful. Unfortunately, what he recovers is pretty messy with fragments from everywhere :(. Couldn't get the file.

A last trick was to look for temporary files of Excel in the HDD of the computer. Unfortunately, couldn't find any in my home or work one. So, I am doom. Looked for my backup, 4 months old, and live with that :(. SUCKS!!

PS.: For those curious, I used DD to restore the image back into the SD card, as it was before running CHKDSK /f and it worked nicely.

No comments:

Post a Comment