How are you doing backups?

asked 2015-10-08 19:57:12 +0300

V10lator gravatar image

I'm currently at the stage of thinking about backup solutions for my Jolla phone. My first idea was simple: Use the Situations app to detect when I'm connected to my wifi, then do a simple tar based backup with this script:

#!/bin/bash

#Step 1: Check if we already did a backup
DATE="$(date +%d%m%y)"
if [ -e /home/nemo/sdcard/tmp/$DATE.bkup ]; then
        exit
fi

#Step 2: Mount nfs if needet
UNMOUNT="$(mount | grep "/home/nemo/horst-NFS")"
if [ -z "$UNMOUNT" ]; then
        UNMOUNT=true
        mount -t nfs4 -o addr=192.168.2.5 nfs-share:/ /home/nemo/horst-NFS
fi

#Step 3: bkup sd card
tar cpf /home/nemo/horst-NFS/bkups/sd-$DATE.tar.xz --use-compress-program=xz --directory=/home/nemo/sdcard .

#Step 4: Unmount if needet
if [ "x$UNMOUNT" == "xtrue" ]; then
        umount horst-nfs:/
fi

#Step 5: Create file so we don't backup again
rm -f /home/nemo/sdcard/tmp/*.bkup
touch /home/nemo/sdcard/tmp/$DATE.bkup

The problem with this: The backup takes ages and the phone randomly reboots (overheating?) way before the backup has finished.

So now I'm thinking about other solutions, the requirements are:

  • Compress
  • Full backup (what is a backup worth if it corrupts together with the original data?)

Any ideas? How are you doing your backups?

edit retag flag offensive close delete

Comments

I mount my phone via SSHFS, and run git add --all . followed by git commit. The /home folder of the phone is a "detached" git repo, with the actual .git folder being on my PC (on external HDD to be exact).

This approach 1) takes as little space as possible - only modified files are saved, 2) allows me to revert to any previous state. The drawback is that the process has to be initiated from the PC and takes a long time. The phone doesn't heat or reboot, though.

ScumCoder ( 2015-10-08 20:06:32 +0300 )edit

I use unison to sync with a NAS. If two-way sync is not needed, rsync is even easier: rsync -aviH --progress --inplace --delete /etc /root /home user@host:/path. Transport is ssh in this case and only changes will be transmitted.

Eierkopp ( 2015-10-08 20:26:56 +0300 )edit

@ScumCoder That sounds good. But is git add --all . really needed all the time? Cause it takes ages to complete.

@Eierkopp But won't rsync corrupt the backup in case the original files corrupt?

V10lator ( 2015-10-08 20:38:04 +0300 )edit

@V10lator: I am in no way a Git expert, but I don't see any alternative ¯_(ツ)_/¯

I mean, if you want to make a reserve copy of all modified and new files, you have to calculate SHA hash of all files in the source tree (/home folder in this case).

ScumCoder ( 2015-10-08 21:01:31 +0300 )edit

I've used Syncthing launched by Situations when on home wifi network.

WilbertS ( 2015-10-08 22:02:50 +0300 )edit