Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


VPS Backup
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

VPS Backup

plumbergplumberg Veteran

I am new to the VPS world. I recently got VPS services from ChicagoVPS, and last week, it was the whole exploit thing which led to several of my sites hosted there being down.

So, I have decided to keep an offsite backup. My question is what is the data which I need to backup inorder to ensure that if I move providers / a fresh vps is provided to me, I can get up and running in least possible time.

  1. I am using VirtualMin on CentOS 6. Does a simple inbuilt-backup of Virtualmin suffice? Any other directories which I need to backup?

  2. I take a backup of the whole VPS ( tar of / directory), and save it in my offsite server. If I need to move providers or restore to a new VPS, a simple untar of the file will work or it will not?

Any help is appreciated.

Comments

  • Install rsync and sync your files. Then once your server is tainted, build a new one and rsync back.

  • any quick example to use rsync to backup/ restore?
    Also, is it for whole server (from root)? or just specific directories?

  • http://troy.jdmz.net/rsync/index.html

    Only the files you have put there that can't be installed as quickly.

  • Hmm, I saw Virtualmin documentation, their backup and restore option is decent. So, as long as I have a bckup of sites and configuration, I should be all set.

  • @plumberg - yes. But also make sure you test your backup from time to time (at least make sure it's not '0 bytes' or months-old). It's better safe than sorry...

  • Ahhh, yes, thats true. But, I am not sure where will I test the backup, I do not have a spare VPS to try.

  • I simply use the 'filesystem backup' module in webmin to transfer the files to a remote location. It gives you the option to compress your files into tar.gz

  • topcattopcat Member

    For each of my servers, I backup my entire machine (i.e., from root), but I leave out the web content being served, which is developed and stored elsewhere and then automatically pushed to the server boxes as it changes, and which I could thus reload with a simple command after getting the server back in operation. I use rsync to a VPS I have specifically purchased for that purpose. (I spawn the rsync daemon on the backup server and use the "fake super" argument to save the files' metadata -- I can discuss the particulars farther if there is interest.) The backup procedure works well, but I have never had to recover from a total system failure. The claim is that if I need to do a complete restoral, I could reload the OS template, boot on it, and then rsync the saved content directly over the top of it (and then reboot) to completely recover the VPS. This sounds risky to me, and especially so if it involves a move to a new VPS with new IP addresses. I don't have a spare VPS to play with so I have not tried a complete restoral. If anyone has successfully pulled this off, I'd love to hear about it, or at least a verification that it can been done.

  • @netsujit said:
    I simply use the 'filesystem backup' module in webmin to transfer the files to a remote location. It gives you the option to compress your files into tar.gz

    so, what exactly is done in the filesystem backup? have you tried to restore it incase of a disaster?

  • @topcat said:
    For each of my servers, I backup my entire machine (i.e., from root), but I leave out the web content being served, which is developed and stored elsewhere and then automatically pushed to the server boxes as it changes, and which I could thus reload with a simple command after getting the server back in operation. I use rsync to a VPS I have specifically purchased for that purpose. (I spawn the rsync daemon on the backup server and use the "fake super" argument to save the files' metadata -- I can discuss the particulars farther if there is interest.) The backup procedure works well, but I have never had to recover from a total system failure. The claim is that if I need to do a complete restoral, I could reload the OS template, boot on it, and then rsync the saved content directly over the top of it (and then reboot) to completely recover the VPS. This sounds risky to me, and especially so if it involves a move to a new VPS with new IP addresses. I don't have a spare VPS to play with so I have not tried a complete restoral. If anyone has successfully pulled this off, I'd love to hear about it, or at least a verification that it can been done.

    Id like to learn more. At this point, I want to ensure that if i even move to a new provider, apart from DNS resolution (if IP changes), I am still able to restore all the content quickly and effectively.

  • asterisk14asterisk14 Member
    edited June 2013

    Me too. I have COMPILED and installed asterisk and a GUI. If I backup my VPS using webmin, can I just get a working asterisk by using this backup on another VPS? Does the OS have to be exactly the same ie Centos 5.8 32 bit etc, what about the dependencies, do they have to be installed manually or will the backup take care of this?

  • Right now, I just backup my sites via Virtualmin's utility. I have daily, weekly and monthly backup jobs running, deleting old daily/weekly backups every 7 days and the monthly every 30 days.

  • @plumberg said:
    so, what exactly is done in the filesystem backup? have you tried to restore it incase of a disaster?

    Yes... I have tried restoring with the same utility. I had backed my database folder and webhost folders to a remote server with 'filesystem backup'. And the same tool helps you to download the files to your server and decompress it. I usually download the files to the tmp folder... decompress it there and manually move the files to it's appropriate place.

    For using this tool to restore... in case of total server break down... it doesn't restore the whole server. You first have to reinstall the server, webmin and then use the tool to restore the files and folders you had backed up... in my case the database and the webhost folders. Of course... you have to reconfigure your server once again with the scripts you want and don't want.

  • topcattopcat Member
    edited June 2013

    Here's the gist of it: On the server (the machine which will hold the backup), create a (non-root) backup user login and home directory. Let's call this login bkup1 and the machine bkupserver. This server box must have a file system that permits the storage of extended file attributes, and of course it must have enough free disk space to house the complete backup of the client. Obviously, both the client and server boxes must have a version of rsync installed on them. Next, you create an rsyncd.config file in the home directory of user bkup1 that contains something along the lines of the following:

    log file = rsync.log
    
    [complete]  
        path = complete  
        use chroot = no  
        read only = no  
        fake super = yes  
    

    Next, on the client machine (the machine being backed up), create a script, executable by root, consisting of something along the lines:

    rsync -avHx --delete --exclude="/var/run" --rsh="ssh" / bkup1@bkupserver::complete
    

    The 'x' argument tells rsync not to venture across a file system boundary, so special directories like /dev and /proc are not backed up. Most VPSes consist of one global root file system which holds all the permanent data. If yours is different -- say you have a separate /var partition -- you'll have to adjust the script accordingly.

    You can, of course, add additional "--exclude" arguments for those parts of the client directory hierarchy you do not wish to back up. I add "--exclude='/home/*/www'" because all the web content I serve up is already backup-up elsewhere. Now, if you run the above command as root, it should produce a complete backup of the client box under the directory ~bkup1/complete on the server. All the files will be owned by the bkup1 user, but their original attributes will be saved as extended attributes, and can be seen using the "getfattr -d" command, and these extended attributes will be used when the files are restored. (You'll also notice that saved symbolic links are munged on the server, but will be correctly restored.)

    To restore selected parts of the backup, simply reverse the order of the last two arguments, and modify them for the purpose at hand per rsync rules. For instance, to restore the /home directory, issue the following command on the client box, as root:

    rsync -avH --rsh="ssh" bkup1@bkupserver::complete/home /
    

    This much I've tested, and it works.

    What I have not tried is performing an entire restoral, i.e., overlaying the complete root file system, on the client:

    rsync -avH --rsh="ssh" bkup1@bkupserver::complete/ /
    

    A side comment: I do not permit passwords in my ssh access to these backup accounts. Instead, I create a pair of ssh rsa keys, storing the private key in ~root/.ssh of the client and a copy of the public key in ~bkup1/.ssh/authorized_keys of the server. Not only is this more secure, but it permits running the script from cron.

    Rsync is a truly amazing program which provides a rich set of options. By adding the appropriate entries to the rsyncd.conf file, you can create multiple independent snapshots that share a common base to preserve space on the server, or which create partial backups which are overlayed on a complete one.

    I've reviewed the above for errors several times, but I make no warranty as to the correctness of any of this. If you try anything I've suggested and manage to blow up your server, don't blame me!

    However, if you do try a complete restore of a client using the above procedure, let us know if it works, and if not, what the problems were.

    Enjoy!

  • @netsujit said:
    For using this tool to restore... in case of total server break down... it doesn't restore the whole server. You first have to reinstall the server, webmin and then use the tool to restore the files and folders you had backed up... in my case the database and the webhost folders. Of course... you have to reconfigure your server once again with the scripts you want and don't want.

    Thanks for confirmation.

  • @topcat said:
    Here's the gist of it:

    Wow, that is very detailed, appreciate your time and help. Will take some time this week to understand and try to replicate what you have posted. Hopefully It will work as is :)

  • asterisk14asterisk14 Member
    edited July 2013

    it doesn't restore the whole server. You first have to reinstall the server, webmin >and then use the tool to restore the files and folders you had backed up... in >my case the database and the webhost folders. Of course... you have to >reconfigure your server once again with the scripts you want and don't want.

    I guess this is the crap thing with linux, have to do most of the heavy lifting yourself. Why is there nothing like Acronis TrueImage, I use this all the time and it gets me up and running with XP in 5 mins!

  • @plumberg @topcat I use a variant of what topcat has there, tutorial coming soon in the Tutorials section. I like to have the result sent to an email address and use executables + the system crontab as a pretty simple, Universal way one might rely on to selectively backup files. Beyond that I would recommend that you simply setup a port 22 connection to your server(s) and just download folders for your /etc/ proftpd vsftpd exim/ dovecot/ files mainly so that you just have your configuration files should you ever need to resetup what you have. Of course backup of home/ or /var/vmail mail/ directories for mail are important on a regular basis also depending on how you have your mail accounts setup. Just some simple thoughts I think most admins can make use of for selective backups. At the same time I've seen some hosts that don't have central backups setup properly. I've never stayed with a host long when features like this for Solus panel etc aren't setup right. So of course also make sure you have a fully working VM panel and all of that too. Any loss of this functionality or backup data from your host really is unacceptable whether they need to temporarily disable for a zero day or not, if that makes sense :x

  • @natestamm said:
    plumberg topcat I use a variant of what topcat has there, tutorial coming soon in the Tutorials section. I like to have the result sent to an email address and use executables + the system crontab as a pretty simple, Universal way one might rely on to selectively backup files. Beyond that I would recommend that you simply setup a port 22 connection to your server(s) and just download folders for your /etc/ proftpd vsftpd exim/ dovecot/ files mainly so that you just have your configuration files should you ever need to resetup what you have. Of course backup of home/ or /var/vmail mail/ directories for mail are important on a regular basis also depending on how you have your mail accounts setup. Just some simple thoughts I think most admins can make use of for selective backups. At the same time I've seen some hosts that don't have central backups setup properly. I've never stayed with a host long when features like this for Solus panel etc aren't setup right. So of course also make sure you have a fully working VM panel and all of that too. Any loss of this functionality or backup data from your host really is unacceptable whether they need to temporarily disable for a zero day or not, if that makes sense :x

    Thanks for the informative post. Makes sense to backup certain directories which hold configuration. But, problem is I do not know where does VirtualMin store the configurations. I am just worried that I may miss something.

  • natestammnatestamm Member
    edited July 2013

    @plumberg The thing is with any panel you have more than just configs you have internal data bases and as one site explained if cPanel and Plesk has a particular feature VirtualMin does too-And I would never recommend just storing a few files from WHM or cPanel or Plesk and trying to restore directly from there. I guess what I was trying to say to your OP is simply #1 yes and #2 no. For your setup check here and don't try to just blindly copy. But important directories and the files that you want to keep tabs on, as well as files created by the internal backup itself should still be kept offsite using some simple key auth based rsync or some thing similar at least. Don't take my post to mean that simply copying over configuration files and such is OK. Then you'll get into habits like modifying core files that panels use without using the panels themselves and/or like you said copying config files through CLI and wondering why your xinetd copy over seems OK in Plesk with some nice green lights while your network services aren't seemingly online and you start pulling your hair out. Definitely go the panel route, just use these backup methods to effectively backup the backups. I think that addresses your original concern which seemed to me basically what happens when my host leaves me hanging.




    One other thing I wanted to mention is I am testing myself right now the use of Rsnapshot. Looks like a great tool. Not that this is any thing new but I have no knowledge of it may be some one else here could chime in.




    Lots of local companies are using cloud backup storage like Amazon and S3 but personally I use hosts here for it.




    So without the rant you DO want to use scheduled panel backups, then scheduled external backups of those as well.

  • @natestamm said:
    plumberg The thing is with any panel you have more than just configs you have internal data bases and as one site explained if cPanel and Plesk has a particular feature VirtualMin does too-And I would never recommend just storing a few files from WHM or cPanel or Plesk and trying to restore directly from there. I guess what I was trying to say to your OP is simply #1 yes and #2 no. For your setup check here and don't try to just blindly copy. But important directories and the files that you want to keep tabs on, as well as files created by the internal backup itself should still be kept offsite using some simple key auth based rsync or some thing similar at least. Don't take my post to mean that simply copying over configuration files and such is OK. Then you'll get into habits like modifying core files that panels use without using the panels themselves and/or like you said copying config files through CLI and wondering why your xinetd copy over seems OK in Plesk with some nice green lights while your network services aren't seemingly online and you start pulling your hair out. Definitely go the panel route, just use these backup methods to effectively backup the backups. I think that addresses your original concern which seemed to me basically what happens when my host leaves me hanging.




    One other thing I wanted to mention is I am testing myself right now the use of Rsnapshot. Looks like a great tool. Not that this is any thing new but I have no knowledge of it may be some one else here could chime in.




    Lots of local companies are using cloud backup storage like Amazon and S3 but personally I use hosts here for it.




    So without the rant you DO want to use scheduled panel backups, then scheduled external backups of those as well.

    Point well noted. I didn't mean to copy specific files here and there, but, on the whole. I have already setup a local backup and currently working on getting an offsite backup (baclupsys is my preferred at this time). So, lets see how it works.

    I get a gist, that incase of a disaster, I get a new VPS setup, install virtualmin, restore virtualmin configuration and then, restore domains as described in the link. But, the million dollar question is will that work...

  • I feel ya on that one. I prefer setting up my server services manually versus using a panel to be totally honest.




    Then you can backup service folders and rely on having to reconcile minor dependencies if it craps on ya'.




    You almost need a utility to mirror the box but I am probably being paranoid.

Sign In or Register to comment.