Plugging in the SD card into your PC to find out it is not getting detected could be the worst nightmare for anyone having thousands of pictures, music and other important data onto it. I have shared many How-to's and utilities to help users recover data but sadly all of them failed or were unable to recover all data on the SD-card which came to me for recovery. After doing a lot of research on why my computer is asking me to "Format" the SD-card instead of reading it's content, I was pretty sure the culprit was a bad file-system boot sector.
While 99.9% of the data recovery applications, both free and paid relied upon the same method to "Scan" and find data from the disk bypassing the file-system "registry" of the files, I was looking for something which will allow me to play with the damaged boot sector of the file-system to recover the underlying "file record registry". Luckily, what I found was not only open-source and free but supported advanced features which nothing else offered, the utility supported NTFS, FAT12, FAT16, FAT32, exFAT, ext2, ext3, ext4, btrfs, BeFS, CramFS, HFS, JFS, Linux Raid, Linux Swap, LVM, LVM2, NSS, ReiserFS, UFS and XFS filesystem and came with cross-platform binaries which can run under DOS, Windows (NT4, 2000, XP, 2003, Vista, 2008, Windows 7 (x86 & x64), Windows 10, Linux, FreeBSD, NetBSD, OpenBSD, SunOS and MacOS X.
The gem, I found was TestDisk - a powerful, free and open-source (GPLv2) data recovery software designed to help users recover lost partitions and/or make non-booting disks bootable again.
TestDisk supports:
- Fixing partition tables and recovery of deleted partitions
- Recovery of FAT32 boot sector from backup
- Rebuilding of FAT12/FAT16/FAT32 boot sector
- Fixing of FAT tables
- Rebuilding NTFS boot sector
- Recovery of NTFS boot sector from its backup
- Fixing MFT using MFT mirror
- Locating ext2/ext3/ext4 Backup SuperBlock
- Recover deleted files from FAT, exFAT, NTFS and ext2 filesystem
Here is how I fully recovered my undetectable SD-Card asking to get "Formatted" when plugged into the PC:
- Download TestDisk from here - http://www.cgsecurity.org/wiki/TestDisk_Download for your operating-system, I am using Microsoft Windows 7 for this tutorial and the SD-card is formatted with FAT32 file-system.
- Run "testdisk_win.exe" and select the damaged disk from the provided plugged-in disk list, double check you are selecting the correct disk.
- Go with the default option provided by TestDisk for "Partition Table Type", in my case it was "None" as shown below:
- Select "Advanced" Filesystem Utils and Proceed.
- Select "Boot" to enter boot sector repair options.
- As you can see in the example below the card's boot-sector is bad, but luckily we have a backup boot sector which is OK, proceed with "Backup BS" option to copy backup boot sector to main record.
- Confirm the action.
- As you can see the main "Boot Sector" is now fixed and labelled OK.
- The SD-card is now fixed and detected normally by computer, the full file-structure is intact and all files are accessible.
- It is advised to backup full SD-card to your computer before unplugging the SD-card now as it can get corrupted once again.