0

I mistakenly deleted some important zip files from my micro-sd card. I want to do data recovery on my micro-sd card. Before doing that I want take image backup of my sd card data, so that I can have backup of my micro-sd card data in case of any crash. From the link askubuntu I came to know that dd_rescue command will do the job.

This link GNU ddrescue Manual provide few examples for how to do data backup. But I couldn't find the exact command to take data backup from sd card to a image file.

What command I need to provide to take image backup of my micro-sd card?

Thanks for the support

Arivarasan L
  • 103
  • 1
  • 3

1 Answers1

0

Since you have no errors on the device you don't have to use "dd_rescue". "dd" is sufficient.

I don't know your system configuration. Therefore I suppose your SD card is device /dev/sdx. To create an image using dd please enter the following commands:

dd if=/dev/sdx of=backup-image.img

It's a good idea to unmount the partitions of the SD card before.

I hope this helps?

tpf
  • 377
  • 1
  • 2
  • 7
  • when I mount my device and entered the command "df -h", it shows /dev/sdb 3.7G 528M 3.2G 14% /media/47AA-11EF. When I unmount my device it doesn't show the /dev/sdb. How could I run the dd command after unmounting my device ? – Arivarasan L Aug 29 '13 at 06:09
  • If you've unmounted the SD card the command "df -h" doesn't show it anymore. – tpf Aug 29 '13 at 06:34
  • Are you sure about /dev/sdb ? This is the device. When mounted "df -h" should show /dev/sdb1 instead. What do see if you run "sudo fdisk -l"? – tpf Aug 29 '13 at 06:36
  • 1
    If "sudo fdisk -l" is showing the device (/dev/sdb) and its partitions you can start the command `dd if=/dev/sdb of=backup-image.img` to create an image. – tpf Aug 29 '13 at 06:38
  • I got "Disk /dev/sdb: 3964 MB, 3964141568 bytes 122 heads, 62 sectors/track, 1023 cylinders, total 7742464 sectors" when i run "sudo fdisk -l". Shall i proceed by the command "dd if=/dev/sdb of=backup-image.img" after unmounting the device? – Arivarasan L Aug 29 '13 at 06:45
  • Yes, please. But I've never seen a proper disk without partitions. Is there not a row like this `/dev/sdb1 16 31116287 15558136 c W95 FAT32 (LBA)` ? Do you see a message like this after running the fdisk command: `Disk /dev/sdb doesn't contain a valid partition table` ? I think your partition table is corrupt. – tpf Aug 29 '13 at 07:53
  • The dd command runs anyway. – tpf Aug 29 '13 at 07:55
  • I run the dd command and got a backup-img.img file, but when i try to mount it with the command "sudo mount backup-image.img /mnt -t iso9660 -o loop" i got " wrong fs type, bad option, bad superblock on /dev/loop0,missing codepage or helper program, or other error" – Arivarasan L Aug 29 '13 at 08:02
  • there is nothing displayed like "/dev/sdb1 ..." when I run sudo fdisk -l. – Arivarasan L Aug 29 '13 at 08:06
  • I dont't think you have an ISO file system on your SD card. Its mostly FAT/FAT32 or ext2/3/4 if used with Linux only. What happens if you plug-in the SD card in the reader? Can you access files in the location /media/47AA-11EF ? – tpf Aug 29 '13 at 08:45
  • If you like to use the created image you have to call `fdisk -l backup-image.img` first to show the partition table. In the partition table you can see the offsets you must enter as parameter when mounting as loop device. But if you can't see a partition table your card is damaged. – tpf Aug 29 '13 at 09:34
  • A damaged partition table could be repaired by "testdisk". See this manual [link](http://wiki.ubuntuusers.de/Datenrettung). After that or additionally you can use dd_rescue or PhotoRec with the image to save lost content. – tpf Aug 29 '13 at 10:25
  • thanks tpf for your support, I create backup image with the dd command and mounted it by the command "sudo losetup /dev/loop0 /home/ars/backup-image.img". Finally I run recovery command "sudo scalpel /dev/loop0 -o myfiles". since my zip file is around 350MB it fails to recover it. – Arivarasan L Aug 29 '13 at 10:32
  • If the files are very important you could give "foremost" or other tools a trial: [link](https://help.ubuntu.com/community/DataRecovery) – tpf Aug 29 '13 at 13:14