backup:laptops
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
backup:laptops [2021/03/10 12:43] – admin | backup:laptops [2023/10/09 14:33] (current) – admin | ||
---|---|---|---|
Line 4: | Line 4: | ||
** All Employee of EPFL are required to do regular backups of the laptop computer they use **\\ | ** All Employee of EPFL are required to do regular backups of the laptop computer they use **\\ | ||
- | For this reason EPFL provide a backup service (Druva InSync) free of charge that every user can request to use. | + | For this reason EPFL provide a backup service (aTempo Lina) free of charge that every user can request to use. |
- | to get your Druva InSync account, please contact your system administrator, | + | |
===== Personal Laptops ===== | ===== Personal Laptops ===== | ||
- | The lab doesn' | + | The Unit IT staff doesn' |
- | + | ||
- | - Homedir: the home directory is to store your work related documents/ | + | |
- | - Scratch server: The scratch server provide space for everyone and there' | + | |
- | - google disk/ | + | |
- | + | ||
- | ===== Syncronizing work stuff with Unison ===== | + | |
- | [[http:// | + | |
- | + | ||
- | Note that, although very convenient, **Unison is not a real backup tool**: it does not keep an history of files, and it tends to replicate mistakes instead of reparing them (a file deleted by mistake on one machine will be deleted also on the other machine). On the other hand, we keep various backup of your home directory on the server. Therefore keeping your laptop in sync with your directory on our file-server is almost like backing it up. | + | |
- | + | ||
- | Here we show how it can be used to keep the work stuff on your laptop in sync with your home directory on the file server. | + | |
- | Here is a short check list of the things to do: | + | |
- | - install unison | + | |
- | - cleanup your directories | + | |
- | - chose and/or prioritize what to synchronize | + | |
- | - decide what to exclude from synchronization | + | |
- | - setup unison configuration files and startup scripts | + | |
- | + | ||
- | ==== Install Unison ==== | + | |
- | You can either download it directly from the [[http:// | + | |
- | + | ||
- | + | ||
- | ==== Cleanup your files ==== | + | |
- | Let's classify our files as //static// or //dynamic// files, and as // | + | |
- | + | ||
- | < | + | |
- | Please **do not use our server for storing your personal static data**. Buy yourself an external Firewire or USB hard-disk instead. The backup of our home directories on tapes takes a long time and the tapes have limited capacity. It is impossible to backup tens of GigaBytes of non-work-related data for every user. The largest the stuff to backup the less frequent and safe the backups are. Please, respect the other users by keeping our disk usage on the servers as limited as possible. | + | |
- | </ | + | |
- | + | ||
- | ==== Synchronization policies ==== | + | |
- | We suggest to use two different policies (two separate configuration files) for synchronizing your data. | + | |
- | - a frequent (hourly) and automatic synchronization for all your dynamic data (we accept here also your personal files if they are not too large); | + | |
- | - an on-demand or less frequent for professional static files. | + | |
- | + | ||
- | ==== What to exclude? ==== | + | |
- | Clearly any **file that is derived from another one** (e.g. compiled files like object .o files, and latex output .dvi files) should be excluded from any backup. Strictly speaking, synchronization is not a backup but excluding non source files will speedup your synchronization process. | + | |
- | + | ||
- | Version control systems can be seen also as synchronization systems. Therefore I (Giovanni) personally exclude also all the files that are under centralized version control (SVN) by adding the '' | + | |
- | + | ||
- | ==== Configuration example ==== | + | |
- | Unison is easy to use, once the configuration file is set. | + | |
- | + | ||
- | $ unison -batch myPolicy | + | |
- | + | ||
- | where '' | + | |
- | + | ||
- | Here is how my main configuration file looks like: | + | |
- | + | ||
- | < | + | |
- | # Roots of the synchronization | + | |
- | root = / | + | |
- | root = ssh:// | + | |
- | + | ||
- | # Here is what I want to keep in sync | + | |
- | path = Archives | + | |
- | path = Documents | + | |
- | path = Learn | + | |
- | path = Notes | + | |
- | path = Projects | + | |
- | + | ||
- | ignore = Path Documents/ | + | |
- | + | ||
- | # Some regexps specifying names and paths to ignore | + | |
- | ignore = Name temp.* | + | |
- | ignore = Name *~ | + | |
- | ignore = Name .*~ | + | |
- | ignore = Name .o~$ | + | |
- | ignore = Name *.{o,x} | + | |
- | ignore = Name *.{tmp, | + | |
- | ignore = Name *.sparseimage | + | |
- | ignore = Name .DS_Store | + | |
- | + | ||
- | # always use rsync for sending files | + | |
- | rsync = true | + | |
- | + | ||
- | # first treat smaller files | + | |
- | sortbysize = true | + | |
- | + | ||
- | # On Mac the default FS is case insensitive | + | |
- | # ignorecase = true | + | |
- | + | ||
- | # Log actions to the terminal | + | |
- | log = true | + | |
- | + | ||
- | # Specific settings | + | |
- | key = 1 | + | |
- | label = Learn directory | + | |
- | batch = false | + | |
- | </ | + | |
- | + | ||
- | Please refer to the [[http:// | + | |
- | + | ||
- | <note warning> | + | |
- | **Be careful with ignore files!!!** | + | |
- | + | ||
- | + | ||
- | Here is an extract from the official documentation: | + | |
- | + | ||
- | It is important to be a little careful when renaming directories containing “ignore”d files. | + | |
- | For example, suppose Unison is synchronizing directory A between the two machines called the “local” and the “remote” machine; suppose directory A contains a subdirectory D; and suppose D on the local machine contains a file or subdirectory P that matches an ignore directive in the profile used to synchronize. Thus path A/D/P exists on the local machine but not on the remote machine. | + | |
- | + | ||
- | If D is renamed to D' on the remote machine, and this change is propagated to the local machine, all such files or subdirectories P will be deleted. This is because Unison sees the rename as a delete and a separate create: **it deletes the old directory (including the ignored files) and creates a new one** (notincluding the ignored files, since they are completely invisible to it). | + | |
- | </ | + | |
- | ==== Do it! ==== | + | |
- | Now that you've prepared and tested your perfect configuration file, it is time to make sure that unison is executed periodically. On unix (linux and mac) you can symply call unison from a script like the following: | + | |
- | < | + | |
- | #!/bin/sh | + | |
- | + | ||
- | # make sure to use always the same hostname even if the actual address of the laptop is variable | + | |
- | export UNISONLOCALHOSTNAME=giovanniMBP | + | |
- | + | ||
- | # make sure to be at EPFL connected on a wired connection | + | |
- | ifconfig | grep 128.178.70 > /dev/null 2>& | + | |
- | if [ $? eq 0 ] ; then | + | |
- | unison -batch main | + | |
- | fi | + | |
- | </ | + | |
- | and launch the script periodically as a cron job. Edit your cron table ('' | + | |
- | < | + | |
- | 38 8-20/2 * * * / | + | |
- | </ | + | |
- | which runs the script every 2 hours between 8:38 am and 8:38 pm. | + | |
- | + | ||
- | Note that the line | + | |
- | < | + | |
- | export UNISONLOCALHOSTNAME=giovanniMBP | + | |
- | </ | + | |
- | of the above script is quite important because the database used by unison for keeping track of which files are changed since last sync depends on the host-name (address) of your machine. Since the laptop gets a different ip address and, therefore, a different host-name each time it is connected to the network it happens often that you have false conflicts: a file is supposed to be changed on both machines only because it was synced on a previous run with a previous host-name. | + | |
- | + | ||
- | ---- | + | |
- | Here is a nicer version of the launch script that keeps you notified about the result of your automatic synchronization: | ||
- | < | ||
- | #!/bin/sh | ||
- | export UNISONLOCALHOSTNAME=giovanniMBP | + | ===== Access file servers using you Personal Laptops ===== |
- | ifconfig | grep 128.178.70 > /dev/null 2>& | + | - Homedir: the home directory is used to store your work related documents/programs/stuff, but you can use it also to store some personal related data (photos/images, videos, documents) if the footprint is relatively small (under 100 GB). |
- | if [ $? -eq 0 ] ; then | + | - Scratch server: The scratch server provide space for everyone and there's no imposed limit (time or space) on its use. Please use it as you like, but adopt a fair play policy, as everyone in the Unit will need to store data. |
- | ofile=$(mktemp | + | - google disk/ |
- | unison -batch main 2>$ofile 1>& | + | |
- | | + | |
- | msg=$(grep " | + | |
- | # DISPLAY=:0.0 notify-send -u low " | + | |
- | growlnotify --title " | + | |
- | | + | |
- | msg1=$(grep " | + | |
- | msg2=$(grep '<-?->' | + | |
- | | + | |
- | # DISPLAY=:0.0 notify-send -u critical -t 0 " | + | |
- | growlnotify --title " | + | |
- | fi | + | |
- | rm $ofile | + | |
- | fi | + | |
- | </ | + | |
- | {{backup: | ||
backup/laptops.1615376627.txt.gz · Last modified: 2021/03/10 12:43 by admin