Migrate RRD Files between Architectures

If you migrate an RRD-based tool like SmokePing, Cacti or ZeroD you may run into the problem, that the target system can no longer use the historic data, if the default number representation changes (big/little endian, 32/64 Bit, …).

In all these cases the following procedure should work. It’s important you dump on the original architecture and restore on the target system.

  • Locate the base of the RRD files.
  • Disable the tool on the source system. You can skip this step, if you can live with the danger of inconsistency, allowing updates on the source system while you transfer the data to the new system. For tests the data loss is acceptable.
  • Dump all RRD files to XML format with the following bash commands:
    find . -type f -name "*.rrd" |
      while read rrd; do
        [ -s "$rrd" ] || continue
        rrdtool dump "$rrd" >"$rrd.xml"
      done
  • Transfer all files of the tool including the RRD files to the new system.
  • Go to the RRD location on the new system.
  • Restore binary RRD files using the following bash commands:
    find . -type f -name "*.rrd.xml" |
      while read xml; do
        [ -s "$xml" ] || continue
        rrdtool -f restore "$xml" "$(dirname "$xml")/$(basename "$xml" .xml)" &&
          rm -f "$xml"
      done

The find command will also respect hierarchically organized RRD repositories, e.g. the data folder of SmokePing.