• Welcome to SCdev.org. Please log in.

Welcome to the new SCdev forums!

Howto: Format SD card in linux

Started by punkrockguy318, June 18, 2007, 10:28:25 AM

Previous topic - Next topic

punkrockguy318

Most of the guides and tutorials on this site are geared for people that are running Windows.  However, some people have opted to use a different (better) OS  :D

There are two things you must do.  The first is to build the partition table on the SD card.  The second is to actually format the card.

======= BUILDING THE PARTITION TABLE ========
* Put in your card to the card reader, and plug it in.

* Open up a command prompt.  In Ubuntu, it's located in Applications... Accessories... Terminal.

* You need to find the device node of your sd card.  Run this command in the terminal: dmesg | tail
This should print some information about your card, and also say what device node it is.  The device node should be sdX.  Remember what the last letter is.

* Run this command with the device node you found in the last step fdisk /dev/sdX

* You are now in the fdisk partition editor.  Enter "p" to see if there are any partitions.  If there are, delete them with "d".

* We need to create a new partition.  Here are the commands you need to enter, pressing enter after each one:
n
p
1
[enter]
[enter]


* We now need the partition to be the FAT16 type, for use with the DS.  Do these two commands, pressing enter after each:
t
6


* You can now write to the disk by pressing "w"

* Take out the card; wait a little bit; and put it back in.

Good!  We've now written to the partition table.

Sometimes, the partition table will get corrupted.  You may see errors like "not find the SD Please turn off GBA".  You may also experience that your card will not show up when you plug it in at times.  If this is the case, repeat the above steps for (re)building the partition table.

===== BUILDING THE FAT16 FILESYSTEM ======
Now that we have the partition table set up, we just need to write the filesystem.  Doing this step will erase all data stored on your card.

* Plug in your card/card reader.

* Open up a terminal (In Ubuntu:  Applications... Accessories.. Terminal)

* Run
dmesg | tail

* Again, find your device node (sdX)

* Run this command to format your sdcard to FAT16 (replace X with the value used in dmesgmkdosfs -F 16 /dev/sdX



I hope someone has found this guide useful.  If anyone has any questions, just let me know and I'll try to answer them the best I can.[/list]

Devil_Spawn

ouch this seems complicated.
bet some ppl will be glad of this tut

eth0

You can also use gparted, most distro's have a package for that. (well at least gentoo, ubuntu and fedora do ^.^)
Sort of looks like the old but wonderful partition magic  :D

slightly related, on mac you can just use the disk utility.

thehunter8478

thank you, is good to know somebody cares about us linux users.