Formatting SDcard
Posted on February 1, 2015
Tags: hacksoft
Typically with disk commands, only sudo
has access, so if you run dd
or fdisk
in userspace, it might appear as not installed.
1 check
ls /dev
#guess it could be /dev/sdc
fdisk /dev/sdc
#tells you the memory size which you use to confirm sdc is the sdcard
2 umount
sudo umount /dev/sdc1
3 dd format (optional)
sudo dd if=/dev/zero of=/dev/sdc bs=512 skip=16 count=32768
- 512 bytes * 32768 = 16777216 bytes = 16.777216 MB
- This will zero out 16.777216 MB after skipping the first (16*512 bytes) of memory.
- dont actually need to do this
- you can just delete existing partitions with
fdisk
instead of zeroing out card
- you can just delete existing partitions with
4 fdisk - create the partitions
sudo fdisk /dev/sdc
- Type n to create a new partition.
- Choose primary partition type by typing p.
- Enter the partition number (e.g., 1) and press Enter.
- Press Enter to accept the default first sector(2048).
- Type +16M for 16MB of the first partition
- Type w to write and save
This will create a empty partition which is /dev/sdc1
5 mkfs - Make file system on partition
mkfs.fat
is symlink aka the same asmkfs.vfat
mkfs.fat
to create FAT32
sudo mkfs.fat /dev/sdc1 #FAT32
#alternatively
sudo mkfs.fat -F 16 /dev/sdc1 #FAT16
6 Mounting
sudo mount /dev/sdc1 /mnt/media