Skip to content

Ajapaik/Odroid_m1_backup_sbc

Repository files navigation

The target for the device is a low-power daily backup device that is robust enough to survive electrical blackouts and simple enough so that it can be duplicated for redundancy when needed.

Workflow

  1. Wake up from suspend
  2. Update e-ink display with message backup started + TIMESTAMP
  3. Send heartbeat information to a remote server
  4. Check that hardware is OK
  5. RSYNC databases
  6. RSYNC images
  7. BACKUP Github repositories
  8. Mount storage disk as read-only
  9. Check using checksums that data was copied correctly
  10. Update e-ink display with message backup was successfully finished + TIMESTAMP
  11. Suspend for 24h and goto #1

Hardware

Install notes

  • m.2 screw is using very small phillips screwdriver head
  • eMMC card needs to be installed before board is installed to KKSB case as there is no room for fingers next to eMMC slot when it is in place
  • Odroid M1 SATA Mount and Cable Kit screws are too long for attaching SSD:st to plate with some drives and additional screws are needed. For example Samsung PM897 screwholes are shorter than screws.

Power consumption notes

  • Board with default OS (emmc with Ubuntu 20.04 ) average power consumption was ~3.5W (2.1.2022)
  • Board with Ubuntu 22.04 via Petiboot (emmc, commandline only) average power consumption was ~4W (2.1.2022)
  • Board with Debian bullseye install via Petiboot (emmc+Samsung 970 EVO Nvme) 8.4W max (4.1.2022)
  • Board with Debian bullseye installed via Petiboot (emmc+Samsung PM897 2.5" SSD ) 4.7W max (21.1.2022)
  • Board with Ubuntu 22.04 via Petiboot (emmc+Samsung PM897, commandline only) average power consumption was 5.7W (21.1.2022)
  • Board with Debian GNU/Linux 11 (bullseye) (emmc+Samsung PM897 2.5" SATA+ 970 EVO Nvme + Badger eink) 4.86 W idle (20.10.2024)
  • Board with Debian GNU/Linux 12 (bookworm) (emmc+Intel 1600x 118GB nvme) idle: 5.3W, load 8W (20.10.2024)
  • Board with Debian GNU/Linux 12 (bookworm) (emmc+Intel 1600x 118GB nvme + PM897 SATA) idle: 6.5W (20.10.2024)
  • Board with Ubuntu 24.04.1 LTS (emmc+Intel 1600x 118GB nvme + PM897 SATA) idle: 6.53 W, with HDMI: 6.96W (20.10.2024)
  • Board with Debian GNU/Linux 12 (emmc+ WD Black SN850X nvme + PM897 SATA) idle: 6.43W, with HDMI: 7W (21.10.2024)

Operating system

  • Debian 11 (installable via Petiboot netboot installer)

Alternatives

OS Notes

Data drive Filesystem options

  • Ext4 + md5sums for detecting bitrot + rsync --backup + optionally par2 data for recovering data
    • simple in filesystem level, but complex to implement scripting
  • Ext4 + FS-PARITY for detecting bitrot + rsync --backup
    • works only for read only files, doesn't allow updating image files
  • Zfs + snapshots + optionally two data copies for self-healing
    • Stable and well working, Incompatible licence with Linux kernel, doesn't work with Petiboot installations (requires Armbian to work out-of-the-box)
  • Btrfs + snapshots + optionally two data copies for self-healing
    • Unstable reputation on unexpected KERNEL HALTS or powerloss
  • Bcachefs
    • Beta and is not mainlined. Requires 6.2 kernel ( = Armbian) . Supports snapshots and checksumming and erasure coding.

Eink display

Badger 2040 with mpremote

sudo apt-get install python3-venv
source venv/bin/activate
pip install mpremote
mpremote exec "import badger2040; badger=badger2040.Badger2040();badger.pen(0);badger.text('Testing ...', 20,20);badger.update()"

Example boot status script

Information in the display

On boot

  • Date/time
  • Local IP address
  • Internet access state (OK/FAIL)
  • Ssh server state (OK/FAIL)
  • State: "START

On failure

  • Date/time
  • Local IP address
  • Internet access state (OK/FAIL)
  • Ssh server state (OK/FAIL)
  • State: "FAILED (NUMBER)"

On backup finished

  • Date/time
  • Local IP address
  • State: "BACKUP READY, SLEEPING..."

GPG Keys

encrypt

cat file.gz | gpg --encrypt --batch --cipher-algo AES256 --compress-algo none -r b763e320fe05cc67744d8353d88eb927 -o file.gz.enc --trusted-key b763e320fe05cc67744d8353d88eb927 
gpg --output private.pgp --armor --export-secret-key b763e320fe05cc67744d8353d88eb927

On target machine

restore

scp username@source.org:/home/backup/private.pgp /home/restore/private.gpg
scp username@source.org:/home/backup/file.gz.enc /home/restore/file.gz.enc

gpg -o private.gpg --export-options backup --export-secret-keys
gpg --decrypt file.gz.enc |gzip -t

Flowchart

About

Source code and example configs for backup sbc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages