Wednesday, March 19, 2014

Format SD Card with Linux partitions

If you have ever used a Raspberry Pi but had to setup the SD card using a windows computer than you know the frustration you get when the disk only shows 56 Mb instead of the 14 Gb that it should be!

I spend a good hour trying to figure this out every time I try and reformat the card with the latest version of Rasbian.  I know I should just keep this in my list of bookmarks, but now I realize that I should just blog the steps as I have with everything else, so that I have it for posterity!

Anyway, Windows 7 has a great tool called diskpart.  Never really knew how fantastic it was until now.  Back in the day it was fdisk, but diskpart is much more powerful and easier to use!

diskpart
list disk
select disk # (the sd card disk number that was listed above)
clean (clears partition table)
exit

This step seems to be required if using my laptop, but I don't know if everyone has to do this or not.
Pull out the sd card and put it back in after a few seconds.

diskpart
list disk
select disk # (is probably the same, but might not be)
create partition primary
format fs=fat32 quick
exit

Done!  It is that easy!

I know that you can also put the card in a camera and format it there to reset the partition table, but I don't have a camera handy all the time!

Hope this helps others.