PDA

View Full Version : SD Card Formatting


belial
17-04-2003, 01:13 AM
Hi everyone,

I need to Format a SD Card (programatically :-) ), and I havn't got the foggiest on where to start, I mean, do I need to build the whole structure on the card myself, or is there some API level I can go to to do the job.

Can anyone help me out here?

jshanab
07-05-2006, 12:22 AM
I did this from my linux box to get set up for linux on the HTC apache and was listing all the gory details.


fdisk /dev/sdb //after verifiing itis correct device
p //print out partition table
d //delete existing partition if not 32M fat 16
n //new partition
p //primary
1 //number
<cr> //Accept default of first cylinder
+32M //make it 32M in size
t 6 //change it to fat16 type

n //create another partition
p //chose primary, even though it is callet ext3
2 //number it 2
<cr> //accept default
<cr> //to use rest of stick
t //set it's type
2 //select second partition
83 //type is linux (ext2 or ext3)
w // write table or you get to do it again

Unplug it and count to 5, plug it back in and cd /dev and "ls -al |grep sd"
it will probably be in a differnt location.
mkdosfs /dev/sdc1 //format the FAT16 partition In gentoo, this was in dosfstools'
mkfs.ext3 /dev/sdc2 //format the linux partition

//create a pair of mount points and mount them
cd /mnt
mkdir MiniSDDos
mkdir MiniSDLinux
mount /dev/sdc1 /mnt/MiniSDDos
mount /dev/sdc2 /mnt/MiniSDLinux
transfer rd,zimiage,default.txt and gnuharet-200603042123.exe to dos partition