How to format any SD card to 2GB

Modules, cases, buttons...

How to format any SD card to 2GB

Postby jonnection » Sat May 30, 2015 9:09 pm

Hello all

Came across this very useful page today. It tells you how you can format bigger than 2GB SD cards down to 2GB

Do not use this information if you do not know the meaning of disk / volume. You can format your hard drive if you are not careful. Use on your own risk !!

Source of article:

https://timescience.wordpress.com/2010/08/09/how-to-downsize-a-4gb-compact-flash-card-to-2gb/
Before starting, please remember that you can seriously mess things up if you make a mistake using command line disk management. Please make 150% sure you are selecting the correct disk so you don’t format your hard drive. You are solely responsible for anything that happens as a result of using this code :)

Instructions for reducing the partition size of a compact flash (CF) card:

Open a command Window (Windows-> Start -> cmd)
Type diskpart
A new window will open up with a “diskpart>” prompt
list disk
select disk n (where n is the number of your CF card)
list volume
select volume n (where n is the number of CF card volume)
clean all (this completely reformats the disk – it will take a while and appear to hang but be patient)
create partition primary (this gives the newly formated CF card a partition so it can be resized)
shrink querymax
This will tell you how much space is currently on available on your CF card. Subtract this from the filesize in MB you want for the final disk than add 1.
For my 4GB disk, shrink querymax returns:
“The maximum number of reclaimable bytes is: 3824MB”
I wanted a final disk size of 2GB which a google search told me is 1954MB so 3824 – 1954 + 1= 1871
shrink desired = 1871 (This tells diskpart to try and shrink the disk by 1871 MB)
Now that the disk is the right size, you can format the partition…
format fs=fat label=”volumelabel”
User avatar
jonnection
 
Posts: 317
Joined: Sun May 04, 2014 8:21 pm

Re: How to format any SD card to 2GB

Postby Sorunome » Sun May 31, 2015 8:40 am

For linux users you can just open gparted, select the sd card, delete all the partitions in it, create a new one of type FAT16 with the size of 2GB!
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm

Re: How to format any SD card to 2GB

Postby jonnection » Thu Jun 11, 2015 10:53 am

But, formatting the card to 2GB will not help.

Gamebuino bootloader can only use authentic SD cards, because the initialization call to a SDHC card is stuck in a neverending loop. Initialization for SDHC is different than SD.
User avatar
jonnection
 
Posts: 317
Joined: Sun May 04, 2014 8:21 pm

Re: How to format any SD card to 2GB

Postby Sorunome » Thu Jun 11, 2015 11:11 am

gparted should handle that for you, if you want to be sure then do:
mkfs.vfat -F 16 /dev/sdXn
That worked for me, I haven't tried the gparted way, though I don't see a reason why it shouldn't work, as gparted does a lot of magic in the background.
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm

Re: How to format any SD card to 2GB

Postby jonnection » Thu Jun 11, 2015 11:26 am

That worked for me, I haven't tried the gparted way, though I don't see a reason why it shouldn't work, as gparted does a lot of magic in the background.


Hi Sorunome

I know you are also interested in SD cards, I put another topic in the forum about it.

SD cards and SDHC cards have different internal MCU and/or firmwares that are initialized with different methods:

http://elm-chan.org/docs/mmc/mmc_e.html

So, even if you format into 2GB, the reply from the SD card internal microcontroller is different between authentic 2GB SD card and a 4GB SDHC card that is formatted to 2GB. The Gamebuino bootloader tries to initialize the card using the CMD1 SEND_OP_COND, but if the card is SDHC it will never return the initialization OK signal = crash. A SDHC uses a different memory addressing system and is initialized using the ACMD41 APP_SEND_OP_COND and several other steps.

This is also the reason why PetitFatFS and SDFat can read SDHC cards but the Gamebuino bootloader can not.
User avatar
jonnection
 
Posts: 317
Joined: Sun May 04, 2014 8:21 pm


Return to Hardware Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron