Archive for November, 2014

Recovering ride data from Garmin Edge 500

Wednesday, November 19th, 2014

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
    • 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>


      <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" >


      <dependency org="org.xerial" name="sqlite-jdbc" rev="3.8.7" >
    • Build
      ./configure && make
  3. Get scalpel:
    git clone .
    ./configure && make && sudo make install
  4. Create a scalpel.conf:
    #fit file definition from
    #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 > fitddump/fitdump.tar.gz
    curl > 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