Sometimes when using SD Card or USB drives for anything other than simple file storage (for instance in a Raspberry Pi, or as a live Linux drive) the card or drive can become re-partitioned or corrupted in a manner that the normal windows disk management tools can’t recover.
Fortunately with a little digging around in a couple of the lesser known Windows management tools it’s usually possible to recover an errant SD card.
Warning – following this procedure will totally wipe your SD Card or USB Drive. Ensure that any data on the drive is backed up. Also, this procedure can be used on internal and external hard drives so please pay attention to which drive you are working on as it’s possible to wipe your main internal drive.
Before you start this procedure you will need to plug the drive you want to fix in to your PC.
Remove existing partitions
- Open a Command Prompt as Admin – Right click the Windows button, and select the option ‘Command Prompt (Admin)‘.
- Once you are in the Command Prompt environment we need to load up the Diskpart tool which is what we will use to fix the SD card. so type in ‘diskpart‘ (without quotes) at the command prompt and press Enter.
- Now that Diskpart has loaded type in ‘list disk‘ (without quotes). You will then see a list of all drives connected to the PC.
- When you see the list, carefully make a note of the drive number you want to fix. In our example we are going to fix the 4gb SD card attached as disk number 5. Now type in the command ‘select disk 5‘ (again, no quotes, and change the disk number to reflect the disk you are working on).
- Enter the command ‘clean‘ and press Enter. When the cleaning process has finished you will see a confirmation on screen.Sometimes drives may be too physically damaged to fix. Re-running the above procedure can occasionally work, if not then it’s probably time to retire the drive.
Partitioning the drive
Cleaned drives will need partitioning before use. The easiest tool for this job is the standard Windows Disk Management console. Log in to the computer as an Administrator
- Right click the Windows button and select ‘Disk Management’ (Win 8.1 & Win 10).
- When the disk management console loads you will see a screen like the one below.
- In the example above the SD Card is mapped to the PC as Disk 1. Right click the area marked ‘Unallocated‘. From the context menu select ‘New Simple Partition’ and format the drive as you need.