backups with rsnapshot

a centralized backup server can easily be set up with rsnapshot. This program can pull specified remote folders with rsync.

  1. install rsnapshot
  2. edit the config file /etc/rsnapshot.conf . The default config is well documented and one has only to modify the given lines. The man page is also of great help (link). I found the following to fit my needs (the path need should be adjusted to each one’s needs)
    config_version 1.2
    snapshot_root /mnt/USBBkupDisk/rsnapshot
    cmd_cp /bin/cp
    cmd_rm /bin/rm
    cmd_rsync /usr/bin/rsync
    cmd_ssh /usr/bin/ssh
    cmd_logger /usr/bin/logger
    cmd_du /usr/bin/du
    retain hourly 4
    retain daily 7
    retain weekly 4
    verbose 5
    loglevel 3
    lockfile /tmp/rsnapshot.pid
    include_file /home/bkuper/DarkTower.include
    exclude_file /home/bkuper/DarkTower.exclude
    backup DarkTower:/home/paul/ paulTower/
    backup DarkTower:/data/paul/ paulTower/
    
  3. the in-/exclude files are the usual one from rsync , e.g. something like this:
    /home/paul/.*
    /home/paul/.*/
    /home/paul/bin
    /home/paul/Downloads
    /home/paul/VirtualBox VMs
    

    one needs to note here, that the order of include/exclude files is important! the first pattern which matches a file takes effect.

  4. the user (here bkuper) needs to be able to sign into the client machine such that it can pull the backup. (ssh-copy-id…)
  5. the interval which were defined above (retain hourly 4 retain daily 7 retain weekly 4) will be applied with a cronjob:
    $ crontab -l
    # do hourly backups at 9,13,19,23h
    0 9,13,19,23 * * *         /usr/local/bin/rsnapshot hourly
    
    # do daily backups at 22:50
    50 22 * * *         /usr/local/bin/rsnapshot daily
    
    # do weekly backups at mondays 22:40
    40 22 * * 1         /usr/local/bin/rsnapshot weekly
    
Advertisements

RPi: automount USB drives via fstab

for mounting external usb drives one can use fstab. each column has its specific meaning (see here for definitions).

for external usb drives it is important to set some specific options:

  • auto: do automatic mounting
  • users: users can mount themselfs
  • nofail: dont expect that drive is attached at boot up
  • x-systemd.device-timeout=1: dont wait no longer than 1s for drive at boot up

full line looks like the following
$ cat /etc/fstab
...
UUID=ffd9b0a1-931f-4795-85ba-28c58719a938 /mnt/USBBkupDisk ext4 auto,rw,users,nofail,x-systemd.device-timeout=1 0 2

raspi: install/configure owncloud

installation process as in this link. just change one step: download the newest owncloud client from their website.

to reset the admin password: sudo -u www-data php /var/www/owncloud/occ user:resetpassword admin

background knowledge: nginx is the webserver which forwards incoming traffic to the php backend by fastcgi (php5-fpm) .

raspi: mount usb drives on bootup

to auto mount usb drives on bootup one can simply add some lines to the /etc/fstab file:

UUID=e0a4c8da-67d1-423d-939c-4dc8249079f0 /mnt/small btrfs rw,defaults,nofail 0 0

you need to change the following:

  • the UUID you can find out through: ls -l /dev/disk/by-uuid/
  • change the mount point
  • change the file system
  • pay attention: the nofail option will mount the drive only if it is plugged in