How to recover data from a memory card for free
So a friend of mine took some pictures on her camera which contains an SD card but for some reason was unable to retrieve the pictures off of it. I have a similar camera and a Mac she has Windows. Many times I’ve been able to access data on removable drives on my Mac that were inaccessible on Windows but not this time.
So my first hurdle was how to mount this drive under the file system. I put the card in my camera but it does a great job of masking that there is a removable drive inside of it. Normally I don’t care. I just plug it in and up comes iPhoto ready to pull the images off and remove them from my camera. So when I plugged her card in, iPhoto dutifully came up…but no pictures. So I found a free piece of software called PhotoRec that would supposedly extract the data from the memory card if I could only see it. So with iPhoto up and running I ran the app, but there was no drive to be seen. For some reason I decided to look around on my Mac to see if by any chance there might be a card reader of some sort and lo and behold right under the CD drive is an SD card reader. Who knew? So I plugged her card into the reader and finally it was properly mounted.
The website for PhotoRec says that as long as you can see the card and the proper size of the card is detected, then there is a very good chance that the data can be recovered. Luckily this card was reporting the proper size. Now PhotoRec is a free application and as such it doesn’t have a fancy user interface that just anybody can click around and figure out. You have to run this utility from the command line. When you run it, you get something that looks like this:
The drive that is 1000GB is my hard drive, the one that is 513MB is the memory card. So I choose the first one /dev/disk2, not the /dev/rdisk2. And I’m given a screen with more options:
Disk /dev/disk2 - 513 MB / 489 MiB (RO)
Please select the partition table type, press Enter when done.
[Intel ] Intel/PC partition
[EFI GPT] EFI GPT partition map (Mac i386, some x86_64…)
[Mac ] Apple partition map
[None ] Non partitioned media
[Sun ] Sun Solaris partition
[XBox ] XBox partition
[Return ] Return to disk selection
Intel seems like a the most reasonable out of the choices so I select that one. I’m then prompted with more choices:
Disk /dev/disk2 - 513 MB / 489 MiB (RO)
Partition Start End Size in sectors
No partition 0 1002495 1002496 [Whole disk]
1 P FAT16 >32M 233 1002495 1002263 [NO NAME]
I’m pretty sure that memory sticks for most cameras are formatted as FAT so I choose that. I’m then prompted with more choices:
1 P FAT16 >32M 233 1002495 1002263 [NO NAME]
To recover lost files, PhotoRec need to know the filesystem type where the
file were stored:
[ ext2/ext3 ] ext2/ext3/ext4 filesystem
[ Other ] FAT/NTFS/HFS+/ReiserFS/…
Again, I choose anything that says FAT, and again I prompted with more choices:
1 P FAT16 >32M 233 1002495 1002263 [NO NAME]
Please choose if all space need to be analysed:
[ Free ] Scan for files from FAT16 unallocated space only
[ Whole ] Extract files from whole partition
You know me, I’m going with FAT. Now I’m asked where I would like to save the recovered files. This is starting to look promising.
Do you want to save recovered files in /Users/socketwiz/bin ? [Y/N]
Do not choose to write the files to the same partition they were stored on.
I choose to store the files on my desktop and then select Y and it begins to attempt to restore the files…FINALLY. A folder is created on my desktop called recup_dir.1 and PhotoRec appears to be recovering the files:
Disk /dev/disk2 - 513 MB / 489 MiB (RO)
Partition Start End Size in sectors
1 P FAT16 >32M 233 1002495 1002263 [NO NAME]
Pass 1 - Reading sector 384119/1002263, 151 files found
Elapsed time 0h01m41s - Estimated time for achievement 0h02m42
jpg: 151 recovered
After around 10-15 minutes all 412 files are properly recovered. Your mileage may vary but I would say if you can mount your card, and the operating system is reporting back the proper size of your card, then you have a pretty good chance of recovering you data from it. This software also runs on Windows and I would expect you would receive the same choices I described above. At any rate, if you or a friend end up with a corrupted memory card give these steps a try, I hope this helps.
New blog software already :)
So I decided I wanted to start blogging again and wrote my own blogging site. Then yesterday I was reading my news feeds and stumbled upon tumblr. I wasn’t really looking to replace my awesome software that I had written myself, but tumblr just has to many features to ignore for a decent blogging site. So I’m going to give it a try, after all the price is right. I don’t understand why people would go through all of this effort to make a wonderful product and then give it away for free. Oh well. Of the many features tumblr has is that it seems there a at least a thousand ways to get content to your blog including an iPhone app. So I think I’m now totally out of excuses for not keeping up with my blog. I’ve been doing OK so far, lets see how this goes…
Python via Cocoa
I have an idea for a Cocoa front-end around a Python script that I recently came across. As you may or may not be aware Cocoa has the concept of a scripting bridge for Python. However, almost all of the examples I could find were to allow Python to use Cocoa as a GUI interface basically. But I want to do is the other way around, use Python for it’s engine from Cocoa. Google being the amazing search engine that it is helped me to find an example that describes exactly that. Using that example I was able to break out the basic concept and build a very simple app that calls a Python script from Cocoa. The python script just calls ls and is then able to print the output back into my Cocoa app’s text view. So the bridge allows a two way communication from Cocoa to Python and back again. This is very cool stuff. Here is a screen shot of my little test app

Here is the Cocoa script that I executed in it’s entirety:
# # RoverExecutor.py # Rover # # Created by Ricky Nelson on 7/16/10. # from Foundation import * from AppKit import * import subprocess class PythonExecutor(NSObject): @classmethod def main_(self, args): textView = args[0]; path = args[1] p = subprocess.Popen('ls /', shell=True, stdout=subprocess.PIPE).stdout textView.textStorage().mutableString().setString_(p.read()) return YES
Now that I have a basic understanding of how it all works I can move on to building my little UI.
First Post
I have never been much for keeping up with a blog. I’ve tried it a couple of times but I just never seem to keep it updated. But I’m always thinking about stuff to put into a blog so I’ve decided it’s time to try it again. This time I’ve written my own blogging application so we’ll see how well it works.
It is my intention to post information on the following topics:
- Mac
- Cocoa
- Web Development
- Symfony
- World of Warcraft
And maybe a few miscellaneous technology related articles such as radio controlled airplanes, helicopters and cars which are some of the things I like to mess around with in my spare time. I’m not sure how often I’ll keep this up to date, but we shall see how it goes.
Graphics editor for the Mac
I am certainly no graphics artist as you have probably gathered from the looks of this site but I seem to be getting a little better thanks to Pixelmator. It is certainly not a Photoshop replacement, but it does just about everything you need for those of us that don’t make a living creating digital graphics. If you are on a Mac and you like to play around with graphics, give Pixelmator a try. It is a fraction of the price of Photoshop and still has many of the important aspects of a decent graphics editor such as layers. There are also many tutorials that show you how to do almost anything you would like to do.