How to make backups?

Discussion in 'Systems Administration' started by Venomous_Creeper, Jun 5, 2017.

  1. Hello,

    I'd like to know if there's a way to have an automatic backup system for all my dedi's files incase the server fails, or something. I need a way to backup either the whole server, or if that's impractical then the following:

    » 1-2 Minecraft servers (w/ a multicraft panel, if that matters)
    » 1 Nameless MC website
    » 1 Xenforo website

    I need an automated daily backup, I'm very new to this stuff so I'm not sure what steps I should take. I plan to have the backup on my dedi's 100gb storage, and maybe get a storage vps for it and back it up on both. I'd also like to know a way to backup just the configs for the plugins, I'll do it daily on my own computer but I can't really do it for all files since my internet is slow (sits at 0.8-1Mbps on a good day).

  2. Most proper providers also have backup plans, or you can rent backup storage without needing to rent an entire machine or vps. You can use scripts to initiate the file transfers, lots of guides and examples for that.
  3. I wrote basically my own script that uploads the backup to a backup storage from the hosting provider over sftp in command line and ssh keys
  4. I'm using SYS so I have a free 100gb backup storage for free. I will look for one with a step by step guide :)

    Is it for CentOS? do you mind sharing?
  5. It's compatible with ubuntu/debian and centos and you would have to configure your backup storage and such. I'll post it whenever I have time at home since I'm going to my work soon
  6. Splazeing


    I'll help you by giving my backup script. Have fun.
    Code (Text):
    DATE=$(date +"%F")
    cd /home/minecraft/backups
    find /home/minecraft/backups/ -type f -mtime +2 -name '*.tar.gz' -execdir rm -- {} +
    cd /home/minecraft/backups
    tar -cvf AllServers-$DATE.tar.gz /home/kees
    • Optimistic Optimistic x 1
  7. Whoa, thats a lot less lines than I thought it would have, I can change the /home/minecraft/backups to my own backup directory right? and do I put this on the root folder? Btw what's the /home/kees for?
  8. I suggest long-term backups off the same machine as the server, for safety.
  9. I strongly suggest using an rsync solution. You won't have the overhead of compression, and it allows you to save a lot of space on the backup server by only backing up files that actually changed.

    There is this nifty little project I personally use that makes using rsync a breeze, called rsnapshot.

    Just set this up, schedule cron job(s), and you never have to worry about it again until you need to restore.

    I have mine setup to hold daily, weekly, and monthly backups for the last year. My server is about 160gb in size, and the backup is about 180gb, so as you see it's very little overhead ;)
  10. Here is my backup FULL backup script
    Code (Text):

    #Set the date for the backup
    DATE=`date +%Y-%m-%d_%H_%M_%S`


    #We need to backup our databases so we need to set a password

    #We need now to set the information from the source server

    #The actual script is here below
    echo "OK... Lets start the full backup of the server.."

    mkdir $TEMPDIR
    cd $MultiServers
    echo "Exporting MySQL databases.."
    mysqldump -p$MYSQLPASS coreprotect > coreprotect.sql
    mysqldump -p$MYSQLPASS lwc > lwc.sql
    mysqldump -p$MYSQLPASS litebans > litebans.sql
    mysqldump -p$MYSQLPASS plots > plots.sql
    mysqldump -p$MYSQLPASS worldguard > worldguard.sql
    mysqldump -p$MYSQLPASS bu_xenforo > bu_xenforo.sql
    echo "Creating zip file"
    zip -r $TEMPDIR/$ * /root /bashscripts -x "mc/spigotbuild/*" "backups/*"
    echo "Zip file creation is done"
    rm *.sql
    cd $TEMPDIR
    echo "Transferring file over to the backup servers"
    echo put $ . | sftp [email protected]
    echo "Transfer is running in the background"
    echo "Moving backup to local storage space outside the temp dir"
    echo "Clearing temp dir"
    cd ..
    rm -fr $DATE
    echo "Script completed"
    exit 0
    By setting/creating variables it makes editing the script a bit easier for myself
    • Like Like x 1
  11. What do you mean? like a separate machine? if so I'll just have it on my computer, and I won't be able to do it more than once a week due to internet speed limitations :(
    Thanks, do I need to install rsync before I follow the guide? and do you use CentOS as well?
    Thank you, does the mysqldump part just specify which parts will be backed up, or is it something else?
  12. Distro doesn't matter. CentOS, Debian, Arch, Ubuntu, Red Hat, ...(lists 1000 other distros)... They're all the same thing, the only difference is the package manager and default packages installed.

    Analogy would be asking "does your fuzzy dice on your Ford's review mirrow fit in my Mazda?" ;)

    Or analogy in a meme:
  13. It exports a databade that was given after the password and save it to a .sql file
  14. You can create an automated task to:
    zip /Servers
    zip XenForo, Panel
    create backup-file of MySQL

    Then automatically upload it to something like your own private collection, or send it to a backup server via SFTP
  15. Splazeing


    Buying a separate machine for backups is a good idea as well which I might do soon as well. It makes less load on your server because there is only read going on, and write on the other machine (or the other way around idk).
  16. On ReliableSite you have backup storage where the data goes through a different network interface card (NIC) so the NIC where the data goes to the world isn't getting any higher load and such