Backup your server for free

Discussion in 'Site & Server Administration' started by M y, Sep 29, 2013.

  1. #1
    Hello.
    You can backup your small dedicated server or vps to Yandex Disk automaticly. You can use any other provider but I am using Yandex because it is providing 10GB space for free of charge. There is not any file size limit also. I am creating a new account from yandex disk for my each vps.

    You can sign up from here: http://disk.yandex.com
    If you sign up from here you will have 11GB: https://disk.yandex.com/invite/?hash=XL0MPV66
    After sign up you will see a Get more Disk space link on the left side. You can use here to get more space for free or paid.

    We are going to reach Yandex Disk via webdav protocol and use duplicity. You must install duplicity to your linux based machine. If you are using Debian, you can install it by typing this code:
    apt-get install duplicity
    Code (markup):
    After install finishes make a file named /root/backup.sh and paste this on it:

    #!/bin/sh
    
    printf "\n\n----------------------------------------------------------------\n"
    date
    printf "\n"
    
    if [ -f /root/.backupRunning ]
    then
      printf "Another backup is running!"
      exit
    else
      printf "Starting backup..."
      echo 1 > /root/.backupRunning
    fi
    
    duplicity --timeout 600 --exclude-other-filesystems --no-encryption / webdavs://yourUserName@yandex.com:yourPassword@webdav.yandex.com/
    
    rm /root/.backupRunning
    Code (markup):
    Note that you must change yourUserName and yourPassword on above script.

    Make executable this script by this command:
    chmod +x /root/backup.sh
    Code (markup):
    Now your backup script is ready! If you run this code:
    /root/backup.sh
    Code (markup):
    it will backup all your system. If you run it again any time, it will backup only changed and newly added files on your system. So this is really fast.

    Also you can add this code to your crontab to make automatic backups. Type
    crontab -e
    Code (markup):
    and add this line at the end of file:
    0 0 */7 * * /root/backup.sh >> /var/log/backup.log
    Code (markup):
    Save the file by pressing CTRL + x
    This will make bacup every week.

    That is all. Use this at your own risk. Maybe this is not a perfect solution but I am using this to solve my backup problem. Feel free to comment if you have any questions.
     
    M y, Sep 29, 2013 IP