Formatting a new SD card

From RidgeRun Developer Connection
Revision as of 18:12, 15 December 2010 by Jweber (talk | contribs) (Created page with '= Formatting a new SD card = This guide shows you how to create an EXT3 filesystem on a new SD card using a linux host computer with an SD card reader. == Discovering the SD car...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Formatting a new SD card

This guide shows you how to create an EXT3 filesystem on a new SD card using a linux host computer with an SD card reader.

Discovering the SD card device

Before you plug in the SD card into the reader, run this command in a terminal.

$ watch "dmesg | tail -10"

Now insert the SD card into the reader and observe the messages in the terminal window.

[11599.200739] sd 3:0:0:0: [sdc] 7744512 512-byte logical blocks: (3.96 GB/3.69
GiB)
[11599.204630] sd 3:0:0:0: [sdc] Assuming drive cache: write through
[11599.210491] sd 3:0:0:0: [sdc] Assuming drive cache: write through
[11599.210495]  sdc:

Use CTRL-C to exit from the watch command and get your prompt back. The SD card device is /dev/sdc, per these messages. The actual device will likely vary on your system.

Unmount and delete any partitions

You might be reusing an SD card that already contains formatted partitions. To discover any partitions:

$ ls -a /dev | grep sdc
/dev/sdc
/dev/sdc1
/dev/sdc2

$

If you see devices with integer number suffixes, these are formatted partitions. You can unmount them using the following commands.

$ sudo umount /dev/sdc1
$ sudo umount /dev/sdc2

You can then use the 'parted' utility to delete them (CAUTION - you are permanently deleting them, make sure you know what you are doing!).

$ sudo parted /dev/sdc rm 1
$ sudo parted /dev/sdc rm 2

Create a new, single partition that encompasses the entire SD card