Backup embedded systems using BackupPC
To backup embedded systems, such as Android phone or OpenWRT router you can use tar command in conjunction with ssh. As I mentioned before this method is almost successful with Android. Now example with Gargoyle router - called device.
Similar to Android devices OpenWRT's tar doesn't support --totals option, so I've prepared wrapper (see below) because it is necessary for BackupPC.
You will need:
- Copy your generated earlier id_rsa.pub to /etc/dropbear/authorized_keys on device. To be able to login without password.
Login to device manually for the first time (to add it to known_hosts):
sudo -u backuppc /usr/bin/ssh -q -x -n -l root router
as you can see I logged as root to device named router. Alternatively you can manually edit known_hosts.
On device create file (ie. /root/tar_totals.bash) to emulate --totals option behaviour:
root@router:~# cat /root/tar_totals.bash tar $* echo "Total bytes written: 10240 (10KiB, 3.6MiB/s)" >&2
and of course make it executable:
chmod u+x /root/tar_totals.bash
(this what I can't do on Android)
Define host in BackupPC with settings:
$Conf{BackupFilesExclude} = {}; $Conf{BackupFilesOnly} = { '/' => [ 'etc' ] }; $Conf{TarClientCmd} = '$sshPath -q -x -n -l root $host $tarPath -c -v -f - -C $shareName+'; $Conf{TarClientPath} = '/root/tar_totals.bash'; $Conf{TarShareName} = [ '/' ]; $Conf{XferMethod} = 'tar';
as you can see only /etc is copied, and I use wrapper instead of tar command.
Now you can backup it. Of course in log you will have:
Running: /usr/bin/ssh -q -x -n -l root router /root/tar_totals.bash -c -v -f - -C / ./etc full backup started for directory / Xfer PIDs are now 23732,23731 Total bytes written: 10240 (10KiB, 3.6MiB/s) (...)
where you can see fake transfer summary.
Unfortunately on Android device you cannot set file as executable:
HWVTR:/storage/emulated/0/ssh $ chmod u+x tar_totals.bash chmod: chmod 'tar_totals.bash' to 100760: Operation not permitted
Komentarze
Log in or create a user account to comment.