Server Backup

Server Backup Reference


Backup to Box.com using Duply and FTP

  • Install duply and lftp: sudo apt-get install duply duplicity python-paramiko python-gobject-2 lftp
  • Create directories: sudo mkdir /etc/duply
  • Create backup: sudo duply fullsystem create
  • Configure duply: sudo nano /etc/duply/NameOfBackup/conf
    • Enter GPG password: GPG_PW='SecurePassword'
    • Comment out GPG_KEY: #GPG_KEY='_KEY_ID_'
    • Enter Box.com ftp address in target: TARGET='ftp://UserNameOrEmail:[email protected]:990/FolderToStoreIn/'
    • Set base directory to back up: SOURCE='/'  (Set the base directory of the backup to backup the entire filesystem)
  • Configure exclusions: sudo nano /etc/duply/NameOfBackup/exclude
    • /cdrom
      /dev
      /home/*/.cache
      /home/*/.ccache
      /lost+found
      /media
      /mnt
      /proc
      /root/.cache
      /root/.ccache
      /run
      /selinux
      /sys
      /tmp
      /u/apps/*/current/log/*
      /u/apps/*/releases/*/log/*
      /var/cache/*/*
      /var/log
      /var/run
      /var/tmp
      /zfsdisk
      /swap
      /swapfile
  • Set Cron job:
  • 0 2 1 * * duply NameOfBackup backup_verify_purge --force
    0 3 * * * duply NameOfBackup backup

Duply

Duply man pages – Ubuntu Duply

  • Setup – 1
  • Reference – 1, 2, 3, 4

Essential Duply commands

  • sudo duply (name) backup
  • sudo duply (name) full
  • sudo duply (name) cleanup –force
  • sudo duply (name) purge (age – 100D or 2015-01-01 formats) –force
  • sudo duply (name) status

Rsync to Box.com

Not as efficient as direct FTP to Box.com.

  • Setup – 1

 

 

Check Disk Usage

  • ncdu -x -q
  • df -h
  • Sources: 1

 

 

Backup Crontabs

Method 1 – Use Crontab tools

  • sudo sh -c ‘crontab -l > crontab[date].backup’

Method 2 – Use GZip

  • Backup/archive: sudo tar -zcvf crontabs.gz /var/spool/cron/crontabs
  • Restore/unpack: sudo tar -zxvf crontabs.gz

Read more: 1, 2, 3, 4

 

e83cb10828e91c72d252440dee4a5b97e771e3d51bb9154297_640_linux