Saturday, June 17, 2017

macos - How do you clone the data off of a flash memory (via digital camera) device for recovery?


I have a digital camera that uses compact flash cards. Currently, I connect the camera to the computer through a USB cable.


The compact flash card appears to have some bad sectors or something, because some of the images are corrupt.


I was hoping to clone all of the data off of the card to play around with recovery, while being able to wipe the card and continue to use it until I can replace it.


It seems like there is likely a way to directly clone data off of a device that shows up as mounted on my OSX desktop (as the camera memory does). Any suggestions? Something that I can then mount again after cloning would be ideal.


Command-line (dd perhaps?) approaches are fine.


Also, wouldn't mind hearing Windows solutions as well, though will give the answer check to an OSX solution.


Answer



dd is the way to go. dd has an option called noerror which will just write blank data if it is unable to read it. I use this method to try and restore dead harddrives etc.


You will need to find what it is mounted as when it comes onto the MAC, to do that you run the following command


diskutil list

This will list each /dev/diskX and then the partion information etc. If you want to clone the whole disk then that is all you will look for, which in this case is what you will want to do. Find you camera on this list. For this example lets pretend that it is /dev/disk4, you will need to then tell dd to run


mkdir ~/camera
dd bs=1048576 if=/dev/disk4 of=~/camera/flash.dmg conv=noerror,sync

The first command will create a new directory to store the dmg that is created. I just made this up, you can make it whatever you want. Then the second command will actually clone what it can get off the stick. bs = bytes per second (above is 1MB) You will probably want to turn this way down, maybe even 512. This is how much it will try to read at a time, so the larger it is the faster the command will run,but the larger the chunk that has a problem is. If you turn it way down it will take a lot longer but you will probably recover more.


Also since this creates a .dmg, you can open it right up on the Mac.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...