How do I create a backup image of an SD card?

I have to copy my SD card to my hard-drive. I know that I have to mount and unmount it, but the following line doesn't work:

dd if=/media/oneiric of=~/sd-card-copy.img

That was my first try, but then I found out that I have to unmount my card and select /dev/sdX. The problem is that the command fdisk -l isn't showing anything. Nothing happens and therefore I can't copy my files.

How can I fix this?


Solution 1:

Run mount | grep "/media/oneiric". This will show the sdcard device (/dev/sdXX). Then run:

sudo umount /media/oneiric
sudo dd if=/dev/sdXX of=~/sd-card-copy.img