C:\cd windows
C:\windows>win.exe

Recover Lost Space from an SD Card

Posted on January 20th, 2016

Help! My 8GB SD card is only showing 113MB! Sound familiar? It can happen to any type of flash memory (or hard drive for that matter) and for many reasons. If you’re here it’s probably because you’ve used an SD card in your Raspberry Pi; you want to reuse it but it’s showing up in Windows at a vastly reduced capacity, even after you’ve formatted it.

Why it’s happened to you doesn’t really matter. Here I’ll show you how to fix the problem in Windows in a few easy steps. Some of the steps here might be redundant depending what exactly is wrong with your card. But following these steps exactly should take no longer than 5 minutes and fix every type of SD formatting/partitioning issues.

Please note. All data on your media will be lost.

What is Diskpart?

The reason you can’t see the full capacity of your SD card is the primary partition is not using all the available space, there’s probably more than one partition or a lot of unallocated space. We’re going to remove all the partitions and recreate 1 primary partition that uses the full capacity of the card.

Diskpart is a Windows command line disk partitioning tool that allows us to do just that.

Starting Diskpart

To start Diskpart enter the following command from Start > Run or your command prompt:

diskpart

Diskpart needs to be run as administrator, so you’ll probably get a dialog box asking you to allow the program to run. Select yes.

Fixing your SD Card

Make sure you SD card is attached to the PC. Run the following command to list the available drives:

list disk

Diskpart list disk

Make sure you confirm exactly which disk you want to modify. Selecting the wrong disk will potentially break you PC. Select the disk that matches your SD card:

select disk 1

Diskpart select disk

Any commands you run now will only effect the selected disk. List the partitions on the disk:

list partition

Diskpart list partition

Now select the partition:

select partition 1

Diskpart select partition

Delete that partition:

delete partition

Diskpart delete partition

List the partitions again, if there’s any more select and delete them as above:

list partition

Diskpart list partition check

Now we can clean the disk, this will remove the Master Boot Record, volume and formatting information:

clean

Diskpart clean

The disk should now have all the available space as unallocated space. That means we can create a new primary partition to take advantage of the full size of the disk. We do this by:

create partition primary

Diskpart create primary parition

Let’s just do one last check to make sure the disk is showing the full sized partition:

list partition

Diskpart list disk fixed

Windows (or whatever device/PC you need to use it with) needs to be able to read and write data to the disk. So we’ll do a quick format using the FAT32 file system:

format fs=fat32 quick

Diskpart format fat32

That’s it! Take your cart out and re-insert it and you’ll be able to use the full capacity of the disk.

SD Card full capacity