Recovering ride data from Garmin Edge 500

For the second time now I lost a ride from my Garmin Edge 500. But this time, thanks to this great blog post I was able to recover the data and upload to strava

I followed the steps in that blog post pretty closely, so this is largely a re-hash of that post for my own reference. But here’s what I did on OSX:

  1. Make a copy of the garmin device using dd
    dd if=/dev/disk2 of=~/temp/garmin.img bs=1m

    You can (but don’t need to) mount the device using Finder:

    open ~/temp/garmin.img
  2. Get sleuthkit
    • Download latest from http://www.sleuthkit.org/sleuthkit/download.php
    • Fix the junit path in bindings/java/nbproject/project.xml . Change from:
      <classpath mode="compile">lib;lib/diffutils-1.2.1.jar;lib/junit-4.8.2.jar;lib/sqlite-jdbc-3.8.0-SNAPSHOT.jar</classpath>

      to

      <classpath mode="compile">lib;lib/diffutils-1.2.1.jar;lib/junit-4.8.2.jar;lib/sqlite-jdbc-3.8.7.jar</classpath>
    • Fix the junit version in bindings/java/ivy.xml . Change from:
      <dependency org="org.xerial" name="sqlite-jdbc" rev="3.8.0-SNAPSHOT" >

      to

      <dependency org="org.xerial" name="sqlite-jdbc" rev="3.8.7" >
    • Build
      ./configure && make
  3. Get scalpel:
    git clone https://github.com/machn1k/Scalpel-2.0.git .
    ./configure && make && sudo make install
  4. Create a scalpel.conf:
    #fit file definition from http://www.thice.nl/recovering-data-from-garmin-edge500
    #fit y 1000000 \x0E\x10\x98\x00??????\x00\x2E\x46\x49\x54\x00\x00\x40\x00 \x01\x00\x00\x1A\x01??# updated fit definition as per data on my Garmin
    fit y 1000000 \x0E\x10\x98\x00???\x00\x2E\x46\x49\x54\x00\x00\x40\x00 \x01\x00\x00\x1A\x01??

    It’s worth noting that the first definition does find some files on the device (perhaps from an earlier version of the firmware), but the second definition finds a lot more files (including the recent file I was missing). I found the common header and footer by using hexdump on some known good .fit files on the device, e.g.

    for f in $(ls -1 2014-1*.fit); do hexdump -n16 $f; done
  5. Run scalpel on the copy of the garmin device:
    scalpel -c scalpel.conf -o garmin.out garmin.img

    There will now be a bunch of files in the garmin.out directory

  6. Get FitDump and GarminFit perl scripts:
    mkdir fitdump; cd fitdump
    curl http://pub.ks-and-ks.ne.jp/cycling/pub/fitdump-0.04.tar.gz > fitddump/fitdump.tar.gz
    curl http://pub.ks-and-ks.ne.jp/cycling/pub/GarminFIT-0.12.tar.gz > garminfit.tar.gz
    tar -xzvf fitdump.tar.gz
    tar -xzvf garminfit.tar.gz
    
  7. Do something like this to find the file you're looking for
    for f in $(ls -1 ../../garmin.out/fit-0-0/*.fit); do echo $f; ./fitdump $f | grep time_created; done > ~/temp/garmin.out/time_created.out

    Then you can look through the time_created.out file to find the file containing the ride you're missing based on the date. You can then directly upload this file to Strava

10 Responses to “Recovering ride data from Garmin Edge 500”

  1. Eric Scalera Says:

    Thank you for the help. Solution worked great; however, was not able to find file.

    Eric

  2. ethan Says:

    @eric, it’s worth poking around some of the known good files (as referenced at the end of step 4) and trying some different file definitions in the scalpel config

  3. paul Says:

    thank you for this great step-by-step manual. being not very fluent in terminal/compiling/installing stuff i ran into some problems. i can’t get scalpel to install as it reports: configure: error: Scalpel requires libtre and libtre-dev. See http://laurikari.net/tre/.
    so i am stuck at this point. i have the image file.
    do you have any advice for me?
    would be greatly appreciated.
    paul

  4. ethan Says:

    Hey Paul, looks like I had to install libtre too. Looks like these are the commands I used:

    curl http://laurikari.net/tre/tre-0.8.0.tar.gz > tre.tar.gz
    tar -xzvf tre.tar.gz
    cd tre-0.8.0/
    ./configure
    make
    sudo make install

    Then I compiled scalpel after that. Let me know if that helps.

    Ethan

  5. Rich Says:

    Hi,

    Having the same issue trying to get Scalpel onto OSX, have installed Tre (as best of my knowledge), but Scalpel is still complaining of the same error above; “Scalpel requires libtre and libtre-dev”

    Sorry to ask, I’m just trying to retrieve a 3hr training ride from today (or at least see if I might be able to retrieve!) – any pointers I would be hugely grateful.

    Cheers,
    Rich

  6. Marieke Says:

    That’s one clear step-by-step manual. I got my hopes up that it might work for my edge 810, but I’m having a problem at the first step. It’s telling me permission denied for dev/disk2. Any suggestions? Thanks.

  7. ethan Says:

    Marieke, you may need to run that command as root, so:

    sudo dd if=/dev/disk2 of=~/temp/garmin.img bs=1m

  8. rkantos Says:

    Thank you! This worked as written! I only followed the image making and scalpel parts and was able to find all missing fit -files from my Edge 500!!! I tried some data recovery programs but they wouldn’t even find the folders “Activities” and “µCTIVI~1”, which probably should’ve contained the nuked .fit files! I could see these folders with Linux/Windows still..

  9. mattb Says:

    Could someone help me with recovering a .bak file or converting it to a file I can use in strava/garmin connect? Thanks

  10. Josh Says:

    Everything works perfectly, except…it can’t find any fit files, even the ones on the device right now (EDGE 500)

    I tested this by doing the following.
    Went onto the GARMIN usb, and pulled out the two current .fit files on the device.
    Created an image of a folder containing those files, then ran scalpel
    It found those files and pulled them out

    When I use the image I’ve created, it finds no files matching the header, but the image should have the two current activities on there, right?

    Please help, I’ve debugged this as best I can, but I’m lost why it’s not finding the current activity files on there.

Leave a Reply