Re: Omega Backup / Restore Instructions
I decided I needed to be able to backup my 4 (and counting!) Omega2 and Omega2+ devices, ideally to one place using the instructions in the aforementioned post.
I erased a spare USB stick under Linux and created 4 primary partitions, each the same size. I labelled each partition with the relevant 4 characters of the MAC address (shown obfuscated here).
On each Onion I then created the /mnt/backup directory before running /root/backup.sh
as shown below.
#!/bin/sh
# backup.sh
# From: https://community.onion.io/topic/2677/omega-backup-restore-instructions
# My machines use /dev/sdb - YMMV !
# get the machine name
MACHINE=`/bin/uname -n`
# get today's date
TODAY=`date +%Y-%m-%d`
# which machine am I on?
if [ $MACHINE = Omega-0001 ]; then
mount /dev/sdb1 /mnt/backup
elif [ $MACHINE = Omega-0002 ]; then
mount /dev/sdb2 /mnt/backup
elif [ $MACHINE = Omega-0003 ]; then
mount /dev/sdb3 /mnt/backup
elif [ $MACHINE = Omega-0004 ]; then
mount /dev/sdb4 /mnt/backup
else
echo "machine $MACHINE unknown - exit"
exit
fi
echo "Backing up $MACHINE"
# final check, to be sure ...
if [ -d /mnt/backup ]; then
echo "backing up..."
else
echo "NO BACKUP DEVICE found - exit"
exit
fi
# standard MTDs
dd if=/dev/mtd0 of=/mnt/backup/uboot.bin
dd if=/dev/mtd1 of=/mnt/backup/ubootenv.bin
dd if=/dev/mtd2 of=/mnt/backup/factory.bin
dd if=/dev/mtd3 of=/mnt/backup/firmware.bin
dd if=/dev/mtd4 of=/mnt/backup/kernel.bin
dd if=/dev/mtd5 of=/mnt/backup/rootfs.bin
dd if=/dev/mtd6 of=/mnt/backup/rootfsdata.bin
# export UCI settings for good measure
uci export > /mnt/backup/UCIexport_$TODAY
echo "all done"
exit
Once the backup is complete on each machine you can then umount /mnt/backup
and remove the USB stick.
So looking at the finished 4 backups on another Linux box, the USB stick is mounted on /dev/sdC, here's a typical directory listing:
ls -l /media/peter/0004-backup
total 41056
-rwxr-xr-x 1 peter peter 1086 Jul 10 13:41 backup.sh
-rw-r--r-- 1 root root 65536 Jul 10 13:38 factory.bin
-rw-r--r-- 1 root root 16449536 Jul 10 13:39 firmware.bin
-rw-r--r-- 1 root root 1341962 Jul 10 13:39 kernel.bin
drwx------ 2 root root 16384 Jul 10 13:08 lost+found
-rw-r--r-- 1 root root 15107574 Jul 10 13:39 rootfs.bin
-rw-r--r-- 1 root root 8781824 Jul 10 13:39 rootfsdata.bin
-rw-r--r-- 1 root root 196608 Jul 10 13:38 uboot.bin
-rw-r--r-- 1 root root 65536 Jul 10 13:38 ubootenv.bin
-rw-r--r-- 1 root root 6459 Jul 10 13:39 UCIexport_2019-07-10
... and free space:
df -h /dev/sdc*
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
/dev/sdc1 6.9G 120M 6.4G 2% /media/peter/0001-backup
/dev/sdc2 6.9G 120M 6.4G 2% /media/peter/0002-backup
/dev/sdc3 6.9G 72M 6.5G 2% /media/peter/0003-backup
/dev/sdc4 6.9G 72M 6.5G 2% /media/peter/0004-backup
As you can see, my USB stick is way too big and I'll see if I can find a smaller device instead.