{
  "id": "14bdb1068ead",
  "url": "http://regex.info/blog/2008-12-03/1016",
  "title": "Recovering Photos from a Corrupt Memory Card with PhotoRec",
  "note": "\nNikon D700 + Nikkor 85mm f/1.4 — 1/6400 sec, f/2.2, ISO 200 —\nfull exif & map — nearby photos\nAlmost Lost\nBrilliant Orange at the Nanzenji Temple, Kyoto Japan\n\n\nI accepted an invite the other day from my friend Shimada-san to visit the\nNanzen'in temple/gardens located in a sequestered back corner of the large\nNanzenji temple complex. It was my first visit to that sub-temple, and I'll\npost more about it later, but suffice to say that it was\nspectacular. I took a bazillion pictures, which I found totally\nmissing when I got home and tried to load them onto my PC. The card was\ncorrupt and Windows hung trying to read it. Yikes!\n\n\n\nNikon D700 + Nikkor 24-70mm f/2.8 @ 55 mm — 1/200 sec, f/6.3, ISO 2500 —\nfull exif & map — nearby photos\nEnjoying the Nanzen'in Gardens\nat the Nanzenji Temple, Kyoto Japan\n\n\nIt's the first time I've had a problem like this in the 10+ years I've\nbeen shooting digital, so I finally had to pay attention to the\nimage-recovery talk that often comes up in online photography forums.\n\n\nI recovered all the photos... the pictures on this post are from among\nthem.\n\n\nIn the hope that it might prove useful to someone, I'll recount how I\ndid it. Having run into the problem on my Windows XP box, I decided to try\nthe recovery on my Mac.\n\n\nI used the most-excellent PhotoRec software to\nrecover the files. It's a command-line program that can run on many\ndifferent operating systems (DOS, Windows, Linux, Mac OS X, FreeBSD...), so\nI did the recovery within a Mac Terminal window.\n\n\n\n\nFirst, I mounted the damaged card, and used the df command to see its raw device name:\n\n\n\n\n% df\nFilesystem              512-blocks      Used   Avail Capacity  Mounted on\n/dev/disk0s2             155367520 148986336 5869184    96%    /\ndevfs                          208       208       0   100%    /dev\n<volfs>                       1024      1024       0   100%    /.vol\n/dev/disk1s1               7536512       704 7535808     0%    /Volumes/NIKON D700\n\n\n\nThe details of what you see would be different on your system, but the\nimportant thing here is to be able to identify the line with the memory\ncard (in my example, the last line), and to then identify the “raw device\nname” at the start of that line. The raw device name will always start with\n“/dev/” and in my example, it's “/dev/disk1s1”.\n\n\n(If there's a way to connect a memory card without OSX mounting it, I'd\nlike to know, because that would be safer.)\n\n\nYou then need to tell OS X to pretend that the memory card is no longer mounted while actually leaving it physically connected to the computer.\nThus, without disconnecting it, run the following (using the raw device name you find in the first step):\n\n\n\n\n% sudo umount /dev/disk1s1\n\n\n\nYou'll have to be an administrator, and will have to enter your password.\n\n\nNow, run photorec. The Mac version is in the “darwin” subfolder\nof the download folder, so after changing directories to the download\nfolder, here's what I ran (again, you'll want to change the raw device name\nto whatever you found):\n\n\n\n\n% darwin/photorec /dev/disk1s1\nPhotoRec 6.10, Data Recovery Utility, July 2008\nChristophe GRENIER <grenier@cgsecurity.org>\nhttp://www.cgsecurity.org\n\nPhotoRec is free software, and comes with ABSOLUTELY NO WARRANTY.\n\nSelect a media (use Arrow keys, then press Enter):\nDisk /dev/disk1s1 - 8152 MB / 7775 MiB (RO)\n\n[Proceed ]  [  Quit  ]\n\nNote: Some disks won't appear unless you're root user.\nDisk capacity must be correctly detected for a successful recovery.\nIf a disk listed above has incorrect size, check HD jumper settings, BIOS\ndetection, and install the latest OS patches and disk drivers.\n\n\n\nI made sure that the raw device name was highlighted, then pressed\nenter. It'll progress through a few more screens where you tell it that the\ncard has an Intel/PC partition-table type, that you want to do the\n“whole disk”, that the filesystem is “Other”, and where you\nwant to save whatever files it can recover. (I had just created a “found”\nfolder on my Desktop, and used that.)\n\n\nMake sure, of course, that you have at least enough free space on the\ndisk as the size of the card.\n\n\nPhotoRec took about two hours to process My Transcend 8GB “300×”\ncompact-flash card, and recovered all the pictures from the day, and\nhundreds of random other shots going back more than a month. I reformat the\ncard each time I go out, but that just marks the disk's table of contents as\nempty, without actually clearing out any data, so the data for random old\npictures remained on the card for PhotoRec to find.\n\n\n\nNikon D700 + Nikkor 24-70mm f/2.8 @ 70 mm — 1/200 sec, f/6.3, ISO 220 —\nfull exif & map — nearby photos\n\n\nPhotoRec does not recover the original filename with a recovered file,\nso whatever images it finds have names filled with apparently random\nnumbers, like “f1535616.jpg”. If your digital-photo workflow involves\nrenaming images based on, say, the image-capture date and time, you don't\ncare what the in-camera filename was, but my workflow keeps the\nin-camera filename, so i wanted to rename the files to what they would have\nbeen.\n\n\nI used this magic incantation, which requires exiftool:\n\n\n\n\nexiftool -q -p 'mv ${filename} JF7_00${filenumber}.NEF;'  *.nef  | sh\n\n\n\nI don't know about other kinds of cameras, but Nikon SLRs include in the\nimage file a “FileNumber” bit of metadata that tells what number was used\nin the in-camera filename. I use exiftool to reference that number,\ninsert it into the pattern for the kind of filename I want, then combine\nthat with a file-rename command.\n\n\nSpiffy.\n\n\n\nIt's probably overkill, but I then used the built-in Mac “Disk Utility”\nto zero-fill the entire memory card, then re-formatted it in my camera.\nGood as new.\n\n\n\nNikon D700 + Nikkor 24-70mm f/2.8 @ 70 mm — 1/250 sec, f/6.3, ISO 200 —\nfull exif & map — nearby photos\n\n\nThe pictures I recovered are nice, but it's not like I couldn't have\njust walked down there again today to take most of them. I'm happy to have\nrecovered them, but I'm most happy about having this experience under my\nbelt, so that these techniques will be at my disposal should I ever be\nfaced with the loss of important pictures.\n\n\nIn thanks for making this experience possible, I sent €25 to the guy who wrote\nPhotoRec, Christophe Grenier. Thanks, Christophe!\n",
  "voice": "excerpt",
  "saved": "2008-12-03T13:03:34Z",
  "host": "regex.info",
  "kind": "page",
  "tags": [],
  "record": "https://links.thingelstad.xyz/links/14bdb1068ead/",
  "markdown": "https://links.thingelstad.xyz/links/14bdb1068ead.md",
  "issues": [],
  "connections": {
    "same_host": {
      "count": 3,
      "page": "https://links.thingelstad.xyz/hosts/regex.info/",
      "nearest": [
        {
          "id": "22cf918c96f4",
          "title": "Jeffrey Friedl’s Blog » Blog Archive » Jeffrey’s Lightroom Configuration Manager",
          "url": "http://regex.info/blog/2007-03-13/395",
          "record": "https://links.thingelstad.xyz/links/22cf918c96f4/"
        },
        {
          "id": "f8d7f4ae7222",
          "title": "Jeffrey's Lightroom Metadata-Viewer Preset Builder",
          "url": "http://regex.info/Lightroom/Meta/",
          "record": "https://links.thingelstad.xyz/links/f8d7f4ae7222/"
        },
        {
          "id": "7a63233f868d",
          "title": "An Analysis of Lightroom JPEG Export Quality Settings",
          "url": "http://regex.info/blog/lightroom-goodies/jpeg-quality",
          "record": "https://links.thingelstad.xyz/links/7a63233f868d/"
        }
      ]
    },
    "same_week": {
      "count": 14,
      "nearest": [
        {
          "id": "963a4c3375c5",
          "title": "Using the EC2 environment for fewer moving parts",
          "url": "http://www.37signals.com/svn/posts/1440-using-the-ec2-environment-for-fewer-moving-parts",
          "record": "https://links.thingelstad.xyz/links/963a4c3375c5/"
        },
        {
          "id": "3de29af03248",
          "title": "Announcing 37signals' new book deal",
          "url": "http://productblogarchive.37signals.com/products/2008/12/announcing-37signals-new-book-deal-.html",
          "record": "https://links.thingelstad.xyz/links/3de29af03248/"
        },
        {
          "id": "7c03c77fa9e5",
          "title": "Fine-tune Your RSS Subscriptions",
          "url": "http://gigaom.com/collaboration/fine-tune-your-rss-subscriptions/",
          "record": "https://links.thingelstad.xyz/links/7c03c77fa9e5/"
        },
        {
          "id": "0f8b4eab8d3d",
          "title": "Photographer Platon",
          "url": "http://www.platonphoto.com/index.html",
          "record": "https://links.thingelstad.xyz/links/0f8b4eab8d3d/"
        },
        {
          "id": "3e90b7b58d77",
          "title": "\"Frost/Nixon\" Review: \"Talky, Weighty... Constantly Engaging\"",
          "url": "http://www.huffingtonpost.com/2008/12/04/frostnixon-review-talky-w_n_148337.html",
          "record": "https://links.thingelstad.xyz/links/3e90b7b58d77/"
        }
      ]
    },
    "mentions": [],
    "mentioned_by": [],
    "saved_twice": []
  },
  "elsewhere": {
    "wayback": "https://web.archive.org/web/*/http://regex.info/blog/2008-12-03/1016"
  }
}
