# Laptop Data Backup Service

## Introduction

This is a service for people to securely backup data on laptops from any Internet connection (as long as ssh is allowed). Although we use the word "laptop", this service works equally well for desktops.

To use this service, you will need

• A connection to the internet.
• A live Maths UNIX account.
• Administrative permission to the computer (Windows only: needed to install WinSynCMS).

You are working on your laptop in another country while at a conference. You have a wifi connection to the Internet. Would you like your data to be safely and securely backed up to a storage server at Maths?
When working on the CMS laptop network would you like regular, scheduled, backups of your data to be taken?
If "yes", to either of the above, then maybe this laptop data backup service is for you.

Note: if the same person uses this service to backup 2 laptops both with the same computer name those backups will go on top of each other, so we suggest you do not do that.

The backups are "snapshots" so the first backup takes a long time, then subsequent backups are of files that have changed since the last backup.

## Windows

We used to provide our own software called WinSynCMS to help automate the backing up of Windows 7 laptops to the Laptop Data Backup Service.  This software is no longer supported.  We are looking into seeing if the ' Windows Subsystem for Linux ' in Windows 10 can be used to run the command line version as explained in the next section.

## Linux and Mac OSX - Command Line Method with a script

Using ssh, rsync and cron (for help: man 5 crontab).

Download the script laptop_data_backup.sh onto the computer where the data you want to backup resides, e.g., your laptop (probably). You may want to put it in your home directory or create a dedicated directory for it. In the following we refer to this directory as the ${SCRIPT_DIR} and we use${CRSID} to refer to your Maths UNIX system login (Common Registration Service identifier). So, for example, if your CRSID is js234 and you decide to put the script in a subdirectory of your home directory called tardis, then executing these two lines in a terminal:

CRSID=js234
SCRIPT_DIR=~/tardis


will allow you to copy and paste the script fragments (which follow below) into the same terminal in order to execute them.

Also download and save in the ${SCRIPT_DIR} the following files: ### Instructions for use # Make this script executable and then run it: cd${SCRIPT_DIR}
chmod u+x laptop_data_backup.sh
./laptop_data_backup.sh

# The script will take you through the following steps:
# 1. editing the configuration file: tardis.conf
# 2. creating the file tardis_backups.txt with a list of directories in it to backup
# 3. creating ssh keys and copying them to the laptop backup server
# 4. editing the excludes list if necessary tardis_excludes.txt

# Mac OS X, at least up until v10.7 (Lion), comes with an old and incompatible version of rsync - see tardis.conf
# for more details.  Enter:

rsync --version

# at a command line prompt to check what version you have.  If you need
# to update it, untar this archive rsync-3.0.6-mac-intel.tgz in the root directory

cd / ; tar xvzf rsync-3.0.6-mac-intel.tgz

# and then set the PATH variable as described in tardis.conf.

# To make this backup run regularly using cron at 18:04 (please choose your own time) each day,
# edit your crontab (with whatever editor ${EDITOR} is set to) by running: crontab -e # and add a line like this (but WITHOUT the leading hash character, '#'): # # 4 18 * * *${SCRIPT_DIR}/laptop_data_backup.sh
#
# DO replace ${SCRIPT_DIR} with the actual path to the script in the # crontab entry above, please. # # Please note that using cron means your computer has to be switched on to make # the backup at the specified time, and connected to the Internet. Note as # well that at the specified time the backup will run irrespective of where # you are. This can cause problems if you have to pay for your data transfer # per unit transferred (e.g., when using a broadband dongle) and you have # accumulated a lot of new data (e.g., you've downloaded a film) since the # last backup was made. To avoid this possibility, and assuming that you are # happy to have the backup run only when you are connected through the # University network, use this cron job instead: # # 4 18 * * * expr$(hostname) : '.*\.cam\.ac\.uk$' >/dev/null &&${SCRIPT_DIR}/laptop_data_backup.sh
#
# a cron job and some comments which will be of particular interest to Mac users.


### Options for Retrieving Data

SFTP (secure file transfer over SSH)

sftp ${CRSID}@tardis.damtp.cam.ac.uk  nautilus - the Gnome graphical file browser typically on Linux nautilus --no-desktop ssh://${CRSID}@tardis.damtp.cam.ac.uk/local/tardis/laptops/${CRSID}  Cyberduck - Libre FTP, SFTP, WebDAV, S3 & OpenStack Swift browser for Mac and Windows, see home page for download and instructions. Also the well known FTP client Fetch will do SFTP protocol. sshfs (MacOSX and Linux can do this, though you may have to install the software) # if you have sshfs (fuse package) installed # to make the mount point for the tardis connection mkdir /tmp/tardis # mount the connection sshfs${CRSID}@tardis.damtp.cam.ac.uk:/local/tardis/laptops/\${CRSID} /tmp/tardis
ls /tmp/tardis # check files are there okay and retrieve if desired
# unmount the directory
cd
fusermount -u /tmp/tardis


Please do NOT mount the fs in a sub-directory of the tree that is being backed up or the backup may descend into the backup and attempt to back that up to the server too. You don't have to be Kurt Gödel to realise that this will probably end in tears!