backup

My backup config

Backup

Backup your files using borg with different intervals and destinations.

Example output

DESTINATION: wd
home    UP TO DATE   (0 days ago at 2016-02-12 18:00)
system  UP TO DATE   (0 weeks ago at 2016-02-10 15:28)
media   UP TO DATE   (0 weeks ago at 2016-02-10 15:29)

DESTINATION: jokke (remote)
home    needs backup (never executed)
system  needs backup (never executed)

'home' (jokke) backup started
VPN connection already established
Connected to jokke-backup
[Borg output...]

'system' (jokke) backup started
VPN connection already established
Connected to jokke-backup
[Borg output...]

Don't forget to unmount!

Requirements

  • Ruby
  • Gem colorize (optional)
  • borg
  • pass
  • openvpn
  • notify-send on remote backup server

Installation

  1. Clone this repo to /tmp
  2. Install borg
  3. Install pass
  4. Install openvpn
  5. Install gem: gem install colorize
  6. Copy backup and backup_lib.rb to a directory which is added to $PATH
  7. For remote backups: Install borg on remote machine and add message_pong to $PATH for notifications about backup process
  8. Change BackupLib::HOME in backup_lib.rb to your home path. Don't $HOME, because of running with sudo
  9. Copy config.yaml to /etc/borg/config.yaml
  10. Make changes in /etc/borg/config.yaml
  11. Add pass file encryption/backup via pass generate encryption/backup
  12. mkdir /backup
  13. Copy pre_backup.sh to /backup/pre_backup.sh and make changes
  14. For remote backups: Configure remote destination in $HOME/.ssh/config
# Backup with borg
# Start VPN /etc/openvpn/jokke.conf first
Host jokke-backup
    User dsiw
    HostName <ip>
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa
    Port 22
    # seconds
    ConnectTimeout 3

I recommend using ssh-agent and gpg-agent.

First backup

  1. Show your current password via echo $(pass show encryption/backup)
  2. Init all your repositories via borg init ... $YOUR_BACKUP_DESTINATION_FOLDER_FROM_CONFIG/home
  3. Start backup -n

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Repository

backup

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • over 6 years ago
  • June 5, 2018
License

Links
Synced at

Fri, 22 Nov 2024 08:50:51 GMT

Languages