Rpi-image-cloner — Automated Raspberry Pi SD card backup tool (Docker / Portainer)

rpi-image-cloner — Automated Raspberry Pi SD card backup tool (Docker / Portainer)

If you’re running openHAB on a Raspberry Pi 24/7, losing your SD card means losing everything — configs, rules, persistence data. I built a small self-hosted web tool to automate SD card backups via SSH.

How it works:
You insert a backup SD card into the Pi (via USB adapter), and the tool SSHs in, runs rpi-clone, and automatically fixes cmdline.txt and fstab with the correct PARTUUID — so the backup card boots directly without any manual steps.

Features:

  • Web UI to manage multiple Raspberry Pis
  • Weekly automated schedules (cron-based)
  • Live progress display during backup
  • Boot partition auto-fix after every clone
  • SSH keepalive — works reliably even for large backups (2+ hours)
  • Encrypted SSH credentials
  • Docker / Portainer ready

Stack: Python · FastAPI · Paramiko · APScheduler · SQLite · Docker

Requirements on the Pi:

  • SSH enabled
  • rpi-clone installed
  • A backup SD card connected via USB adapter

GitHub: GitHub - pierrecinema/rpi-image-cloner: Web-based Raspberry Pi SD card backup tool via SSH — with auto boot-fix, weekly schedules and Docker support · GitHub

Full setup guide with step-by-step instructions is in the README. Happy to answer questions!

Are you aware that the SD mirroring functionality has been available in openHABian in a long time?

Yes, but that’s not openhabian, that’s openhab on Docker. It’s not just for openhab, it works with any Raspberry Pi.

PS make a complete image clone

Well it’s openHAB on Docker on Raspberry Pi and I wonder why one should stack stacks like that - you don’t need or benefit from Docker in that case, it’s even harmful and just adding overhead.
No good idea on a lowmem hardware in fact.
The openHABian SD mirroring feature also creates a bootable image of the whole box, i.e. it’s also applicable if you install additional stuff beyond openHAB (no matter if you use containers).
And it’s fully automated and minimizes downtime: in case of SD failure, you just need someone to swap cards and restart your box. No need to have PC access to restore the backup right the moment you’re in trouble.
And really anyone like your mom or neighbour can handle that - very handy in remote locations.

Yes, but openHAB requires a separate Raspberry Pi. Many applications run very stably on my Docker container. With my tool, you don’t need a PC to perform the backup, as it uses the Raspberry Pi’s USB port. Just swap the SD cards.