SD Card

From Indie IT Wiki

HOWTO: Partition And Format

Put the SD Card in a USB adapter and then into the computer.

Check which partition it is (which will be the last one listed, in this case /dev/sdb)...

sudo lsblk

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   100M  0 part 
├─sda2   8:2    0 222.5G  0 part 
├─sda3   8:3    0  20.1G  0 part 
├─sda4   8:4    0     1K  0 part 
├─sda5   8:5    0 219.2G  0 part /
└─sda6   8:6    0   3.9G  0 part [SWAP]
sdb      8:16   1  29.7G  0 disk 
└─sdb1   8:17   1  29.7G  0 part 

Run the command fdisk to delete and create partitions...

sudo fdisk

Delete the existing partition...

Command (m for help): d

Create the new partition...

Command (m for help): n
Partition type:
p   primary (0 primary, 0 extended, 4 free)
e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-62333951, default 2048): PRESS ENTER
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-62333951, default 62333951): PRESS ENTER
Using default value 62333951

Change the partition type to W95 FAT32...

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)

Write the changes and exit...

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

Check the partition...

sudo fdisk -l /dev/sdb

Disk /dev/sdb: 31.9 GB, 31914983424 bytes
32 heads, 32 sectors/track, 60873 cylinders, total 62333952 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    62333951    31165952    b  W95 FAT32

Format the partition... (BE CAREFUL HERE YOU CHOOSE THE CORRECT DISK)

sudo mkfs.vfat /dev/sdb1

Take SD Card or USB Adapter out of the computer, and re-insert again.

You will now see the drive in your File Manager software.

Thanks - http://www.nico.schottelius.org/blog/format-sd-card-usb-stick-under-linux-for-canon-cp800-printer/