Blog

How to format SD Memory Card using dd command in Linux

Posted by:

How to low level format a SD memory card ?

  1. The command dd is used to low level format the card
  2. The command fdisk is used to create a new primary partition
  3. The command mkfs.vfat us used to create the FAT32 file system
kerphi@ketchup:~$ sudo dd if=/dev/zero of=/dev/sdd
dd: écriture vers `/dev/sdd': Aucun espace disponible sur le périphérique
1974273+0 enregistrements lus
1974272+0 enregistrements écrits
1010827264 octets (1,0 GB) copiés, 1090,36 seconde, 927 kB/s

kerphi@ketchup:~$ sudo fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdd: 1010 MB, 1010827264 bytes
32 heads, 61 sectors/track, 1011 cylinders
Units = cylinders of 1952 * 512 = 999424 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1011, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1011, default 1011): 1011

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

kerphi@ketchup:~$ sudo mkfs.vfat -F 32 /dev/sdd1
mkfs.vfat 2.11 (12 Mar 2005)

NOTE: All of this post is copied from link : http://www.zeitoun.net/articles/low-level-format-sd-memory-card-linux/start , Because I always forget how to make it.
0