SD cards wear out, and a picture frame runs all day, every day. Sooner or later a card will fail, and with it your settings and your photos.

The easiest protection is a USB stick that stays plugged into the back of the frame. Once a week, the Raspberry Pi copies itself onto that stick while the frame keeps running. If the SD card ever dies, you take it out, switch the frame back on, and it starts from the stick exactly as it was.

It takes about fifteen minutes to set up, and you only do it once.

What you need

  • A USB stick (or small USB SSD) that is at least as big as your SD card. A 32 GB card needs a 32 GB stick or larger.
  • About 15 minutes.

Everything on the USB stick will be erased. Use an empty one.

Step 1: Open a terminal on your frame

Connect to your frame the same way you did when you set it up: with a keyboard and screen attached, or over SSH.

You should see a line ending in $, something like:

pi@frame:~ $

All commands below are typed there. Type (or paste) each one and press Enter.

When a command starts with sudo, the Raspberry Pi asks for your password. Type it and press Enter. Nothing appears on the screen while you type. That is normal.

Step 2: Plug in the USB stick and find its name

Plug the USB stick into a free USB port on the Raspberry Pi. Then type:

lsblk -d -o NAME,SIZE

You will see a short list, for example:

NAME         SIZE
sda         57.3G
mmcblk0     29.7G
  • mmcblk0 is your SD card. Leave it alone.
  • The other line is your USB stick. It is almost always called sda. You can tell by the size.

Write down the name. The rest of this guide uses sda. If yours is different, use your name instead.

Step 3: Install the backup tool

Type this in one line:

curl https://raw.githubusercontent.com/geerlingguy/rpi-clone/master/install | sudo bash

It takes a few seconds. This installs rpi-clone, a small free tool that copies a running Raspberry Pi onto another disk.

Step 4: Make the first backup

Type:

sudo rpi-clone sda

The tool now asks you a few questions:

  1. "Initialize and clone to the destination disk sda? (yes/no)": type yes and press Enter. This erases the stick and prepares it.
  2. A question about a "label": just press Enter to skip it.
  3. "Hit Enter when ready to unmount…" at the very end: press Enter.

The first backup takes 10 to 20 minutes. Your frame keeps showing pictures the whole time. When you see the $ line again, it is done.

Step 5: Make it run automatically every week

Type:

sudo crontab -e

If you are asked to choose an editor, type 1 (for nano) and press Enter.

A text file opens. Use the arrow keys to go to the very bottom and paste this line:

0 4 * * 0 /usr/local/sbin/rpi-clone -U sda > /var/log/rpi-clone.log 2>&1

Then save and close:

  1. Press Ctrl + O, then Enter (saves).
  2. Press Ctrl + X (closes).

From now on, the frame updates its backup every Sunday at 4 a.m. without asking any questions. Updates after the first one only copy what has changed and take a few minutes.

Step 6: Test your backup (do not skip this)

A backup you have never tried is only a hope. Test it once now:

  1. Shut the frame down:
    sudo shutdown now
    
  2. Wait until the green light on the Raspberry Pi stops blinking, then unplug the power.
  3. Take out the SD card. Leave the USB stick plugged in.
  4. Plug the power back in.

The frame should start up and show your pictures as usual, this time from the USB stick. It may take a little longer than normal.

When it works, shut down again, put the SD card back in, and switch the frame on. It will start from the SD card again, and the stick goes back to being your backup.

If your SD card dies

Take the broken SD card out and switch the frame on. It starts from the USB stick, and everything is as it was at the last weekly backup.

You can keep running the frame from the stick. If you would rather go back to an SD card, put a new card in while the frame is running from the stick, and type:

sudo rpi-clone mmcblk0

Answer the questions as in Step 4. Afterwards, shut down, and the frame will start from the new card. Remember to run Step 4 again so the stick is a fresh backup.

Good to know

  • Leave the stick plugged in. If it is missing on a Sunday, that week's backup is simply skipped.
  • The backup is a copy, not an archive. If you delete a photo by mistake, it will also be gone from the stick after the next Sunday.
  • Want to check that the last backup ran? Type sudo tail /var/log/rpi-clone.log. The last lines should end without an error message.

Found a problem or got stuck on a step? Let me know.