10

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?

Fern Moss
  • 8,685
  • 6
  • 42
  • 61
Adi
  • 103
  • 1
  • 1
  • 4
  • 2
    fdisk requires root privileges. Try typing `sudo fdisk -l` instead. – hmayag May 23 '13 at 13:23
  • Ok Great. I could have had the same idea if I would have thought of it. ok so this works now. But how do i know now which of the devices my sd-Card is. I umounted it and i dont recognize any difference – Adi May 23 '13 at 13:29
  • `sudo blkid` will list all your devices, their identifiers, and labels, e.g. `/dev/sdc1: SEC_TYPE="msdos" LABEL="FooBarBaz" UUID="1234-1234" TYPE="vfat"`. That should give you some indication - the above you would see if you named your card `FooBarBaz`, and it would be at /dev/sdc1 . I'd probably copy the whole disk (`/dev/sdc` here) instead of just the first partition (`/dev/sdc1`). – Piskvor left the building May 23 '13 at 13:50

2 Answers2

18

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
Eric Carvalho
  • 53,609
  • 102
  • 137
  • 162
  • ok the device is now /dev/mmcblk0p1 can this be true? i've read everywhere something with sdX so this confues me – Adi May 23 '13 at 13:34
  • That's it. I have only seen mmcblk0p1 in android devices. sdX is used for hard disks and usb sticks. Maybe this is the right device name for card readers. – Eric Carvalho May 23 '13 at 13:39
  • 7
    @Eric Carvalho: `/dev/mmcblkX` is used for (SD,MMC,...) card readers, it's quite common in laptops (some readers report as normal USB drives - getting the `/dev/sdX` name - some use this convention); `/dev/mmcblk0p1` would be the first partition on a card in card reader #0. – Piskvor left the building May 23 '13 at 13:51
  • You can go extra mile and compress your image using pishrink https://github.com/Drewsif/PiShrink – M.Hefny Apr 23 '21 at 17:47
0

If you prefer a GUI approach you can use the Disks application that comes installed on Ubuntu by default.

The following steps work to create an image of most types of drives, SD cards and USBs included.

Steps:

  1. Insert the SD card/USB/hard drive.
  2. Open the Disks application.
  3. Locate, then select, the drive you want to image in the left column.
  4. Click on the "Drive Options" button at the top right of the app. On newer versions the button's icon is three vertical dots, on older versions it's a gear.
  5. Select "Create Disk Image..." from the menu.
  6. Specify a name and location to save the image.
  7. Click "Start Creating..."

It can take a while depending on the size of the drive but after some amount of time you should have you disk image.

DaveLak
  • 105
  • 6