Wednesday, 14 September 2016

Yet another backup rsync script. This one works on Ubuntu, 2016 September.

For some reason, my old backup scripts aren't working. A simpler approach is to add this sort of thing to a script called by cron:

rsync -vrmxz --progress --include='*.ipynb' 
  --include='*/' --exclude='*' /home/me /mnt/J/backup/
which starts at the current directory and works through all sub-directories, grabbing each .ipynb file and copying it to /backup. The parameters: a: archive mode. Preserve attributes. v: verbose. Not needed for the silent cron version. z: compress during transfer. Not needed if creating a first copy locally but useful for network xfer. x: one filesystem: don't cross file-system boundaries. r: recursive. m: prune empty directories. Essential. progress: live feedback. Not needed for silent cron version. include: files to include exclude: files to exclude. This is required even though we used an include command. *.* is essential. Make neater using variables:

hour=`date +%H`
i="ipynb"
rsync -vrmxz --progress --include="*.$i" --include='*/' 
  --exclude='*' /home/me /mnt/J/backup/hour$hour/
Regarding ddrescue solutions, watch for squashfs: it will create a compressed backup image that can be mounted. Seems better than ddrescue piped to gzip or so.

No comments:

Post a Comment