Prepare disk correctly

First we need to insert SD card into a slot, USB adapter or to device with Mass Storage Mode (for example smartphone with Android). After connecting with PC, your file manager's daemon will inform you that “new disk is found”. Also SD card will be automagically mounted.

But after clicking “unmount” in PCManFM, device is invisible to system. How we can fix it? We must use a workaround.

How is called my SD card

In Linux “everything is a file”, and devices too. All hardware is placed into /dev directory. Also, when you are attaching device that looks like data storage, fdisk will try to found partitions table.

After opening terminal and becoming root (sudo su or just su), we must use fdisk with parameter -l to print partitions available. Of course, we can pipe it through grep dev to make output more clear. Here is an example from my PC:

# fdisk -l | grep dev
Disk /dev/sda: 120.0 GB, bytes: 120034123776 
/dev/sda1   *        2048    33554431    16776192    7  HPFS/NTFS/exFAT 
/dev/sda2        33554432   234440703   100443136    7  HPFS/NTFS/exFAT 
Disk /dev/sdc: 500.1 GB, bytes: 500107859968 
/dev/sdc1   *        2048    48828415    24413184   83  Linux 
/dev/sdc2       974819328   976771071      975872   82  Linux swap / Solaris 
/dev/sdc3        48828416   974819327   462995456   83  Linux 
Disk /dev/sdb: 3900 MB, bytes: 3900702720 

We must recognize device by size. My SD card has capacity of 4GB - as we see it's sdb. My hard drive and system drive are sdc and sda - we don't want to format them :)

How is mounted my SD card

Of course, every partition before reading it's contents, must be mounted. I don't know how to disable this “antifeature” of PCManFM, but I can unmount SD card quickly from terminal.

Referring to earlier step, we know that device is called sdb (on my PC). Now, we can use mount to print list of mountpoints, but with piping through grep sdb will give us clear answer:

# mount | grep sdb
dev/sdb on /media/7D15-C41F type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,blahblahblah...

As we see, sdb is mounted as /media/7D15-C41F, so we can safely umount it:

# umount /media/7D15-C41F

. Ready! It's time to dump image to SD card!