backup:laptops
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
backup:laptops [2008/08/19 10:59] – cangiani | backup:laptops [2023/10/09 14:33] (current) – admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Backup of Laptops ====== | ====== Backup of Laptops ====== | ||
- | Laptops are the nightmare of any system-manager. Not only they are always a special case, therefore taking the same amount of work as 50 identical workstations, | ||
- | The files on a laptop are much more in danger than those on a workstation or on a file server: the laptop HardDisk is smaller and more fragile, the laptop can get stolen or lost, laptops get into many different uncontrolled networks.... | ||
- | Nevertheless, | ||
- | As Laptops become more and more convinient to use, the important work data also becomes more and more in danger. It is useless to have a sophisticated centralized backup system as the one described above if users keep their important data on their laptop. So **please backup your work data as often as possible**. Afterall, your work data belongs to EPFL. | ||
+ | ===== EPFL Backup System for Laptop ==== | ||
- | ===== Syncronizing work stuff with Unison ===== | + | ** All Employee of EPFL are required |
- | [[http:// | + | For this reason EPFL provide |
- | Here is a short check list of the things | + | |
- | - install unison | + | |
- | - cleanup your directories | + | |
- | - chose and/or prioritize what to backup | + | |
- | - decide what to exclude from the backup | + | |
- | - setup unison configuration files and startup scripts | + | |
- | ==== Install Unison ==== | ||
- | You can either download it directly from the [[http:// | ||
+ | ===== Personal Laptops ===== | ||
- | ==== Cleanup your files ==== | + | The Unit IT staff doesn't provide direct support to personal |
- | Let's classify our files as //static// or //dynamic// files, and as //personal// or // | + | |
- | < | ||
- | 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 | + | ===== Access file servers using you Personal Laptops ===== |
- | 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? ==== | + | - Homedir: the home directory is used to store your work related documents/ |
- | Clearly any file that is derived from another one (e.g. compiled files like object .o files, | + | - Scratch server: The scratch server provide space for everyone |
+ | - google disk/ | ||
- | It is sane to **use only one synchronization system** for a given file. Version control systems are in fact synchronization systems. Therefore one should exclude also all the files that are alreadt under version control (cvs, svn, mercurial...). | ||
- | I use to to append '' | ||
- | ==== 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 *_svn | ||
- | 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:// | ||
- | |||
- | < | ||
- | **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>&1 | ||
- | 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 | ||
- | |||
- | ifconfig | grep 128.178.70 > /dev/null 2>&1 | ||
- | if [ $? -eq 0 ] ; then | ||
- | ofile=$(mktemp / | ||
- | unison -batch main 2>$ofile 1>&2 | ||
- | if [ $? -eq 0 ] ; then | ||
- | msg=$(grep " | ||
- | # notify-send -u low " | ||
- | growlnotify --title " | ||
- | else | ||
- | msg1=$(grep " | ||
- | msg2=$(grep '< | ||
- | msg3=$(grep '< | ||
- | # notify-send -u critical -t 0 " | ||
- | growlnotify --title " | ||
- | fi | ||
- | rm $ofile | ||
- | fi | ||
- | </ |
backup/laptops.1219136392.txt.gz · Last modified: 2008/08/19 10:59 by cangiani