Skip to main content

Best way to backup data before rebuilding VPS

Comments

12 comments

  • Spork Schivago
    I see a Restore a Full Backup / cpmove File option in WHM under WHM >> Backup, but I don't really see where I can create one of these Full Backup / cpmove files. Do they have to be created using some sort of script? Would they backup the full cPanel / WHM installation, with all the configuration options, etc? I also need to look into figuring out if I can save the list of packages that I've installed via yum, so I can easily reinstall them and not have to try and remember which packages I installed over time.
    0
  • Infopro
    I need to rebuild my VPS and start over.

    Running a server isn't like running windows on your PC, things can be fixed by fixing them. Unless you've made some sort of catastrophic mistake, it can probably be sorted. What issues are you facing that you're interested in reloading the server if I may ask?
    I see a Restore a Full Backup / cpmove File option in WHM under WHM >> Backup, but I don't really see where I can create one of these Full Backup / cpmove files.

    These are your account backups. You can create them by setting up backups on your server. You could set those backups to be sent to a new server as well and restore from there to the new server.
    0
  • Spork Schivago
    Running a server isn't like running windows on your PC, things can be fixed by fixing them. Unless you've made some sort of catastrophic mistake, it can probably be sorted. What issues are you facing that you're interested in reloading the server if I may ask?

    Although I have a good bit of experience with Windows, most of my experience is with *nix like operating systems. Currently, because of financial restrains, my production server is also my development server. I know this is not a good idea. When I was growing up, we would store OS independent packages in /usr/local/. For example, software installed via the package manager would never install to /usr/local/. It seems somewheres along the lines, either I mistakenly learned false information or something has changed. It seems people tend to use /opt now for non OS managed software. I updated perl in cpan, but configured it to use /usr/local for the installation prefix. This, I now believe, was my first mistake. I believe I made a 2nd as well, but haven't really looked too much into it. I assumed the perl and cpan I was executing would put the perl modules separate from the version of perl and cpan that come with CentOS. It didn't. So, I have a hodge podge of mismatched stuff. I tried undoing what I did, but as I'm sure you already know, it's not very easy to remove a cpan module. I ran upgrade /(.*)/ inside cpan, thinking I was in a fully isolated installation. To try and remedy my mess-up, I downloaded the source for perl-5.24.1 and compiled and installed, using the same configuration options I had used in cpan. I did a make install and then removed every file that was installed. The modules that were installed inside cpan still reside though, at this point, instead of trying to figure out what's what, I figured it's best just to rebuild the server.
    These are your account backups. You can create them by setting up backups on your server. You could set those backups to be sent to a new server as well and restore from there to the new server.

    What exactly do they back up? I see I can run /scripts/cpbackup --force to force a backup. I can only select cPanel users, which makes sense I guess, but my fear is I'm going to think the backup fully backed up cPanel / WHM with all the configuration files that I've changed over time and then find out it only backed up certain things. I have Backup Accounts, Backup Suspended Accounts, Backup Access Logs, Backup Bandwidth Data, Backup System Files selected and for databases, I have Per Account and Entire MySQL Directory selected. I have non-cPanel users as well and I also have files in the /root directory. I'll probably have to back those up manually. Will this backup the cPanel plugins, my DNS records, my SSL certificates that I have installed and configured in WHM (I used the WHM APIs to install them), and what will it not backup? I have ConfigServer Firewall installed in WHM as a plugin, if that's backed up, will it also backup the config files for it? I have some Apache .local template files that I use, will they be backed up as well? I also have DNSSEC configured, will I have to reconfigure that? Finally, I have crontab entries. Will they be included in the backup? Probably not, right? That's something I'd have to manually backup as well. Thanks!
    0
  • Spork Schivago
    I mean, if you think you can sort out where the various files went when I was inside cpan, I can manually remove them and then probably use yum to reinstall the originals. Here's an example, I installed spamassassin in cpan, but I thought it'd be a parallel installation and everything would go under the /usr/local/ directory. I see on my system:
    /var/lib/spamassassin/3.004001 /var/lib/spamassassin/compiled/5.022 /var/lib/spamassassin/compiled/5.024 /usr/local/bin/spamassassin
    cPanel uses spamassassin. I know the /usr/local/bin/spamassassin is from the parallel installation, but what about the /var/lib/spamassassin files? I'm thinking one or two of them belong to cPanel while the other one is from my attempted parallel installation of perl / cpan. In the /usr/local/bin/ directory, I see:
    . config_data crc32 graph-easy lwp-download net-server razor-check sa-check_spamd spamc tpage .. cpan2dist crontab hypnotoad lwp-dump oscartest razor-client sa-compile spamd ttree bdf2gdfont.pl cpandb cvtbdf.pl imgsize lwp-mirror package-stash-conflicts razor-report sa-learn spfquery xmltidy bdf2gdfont.PLS cpanm ea_convert_php_ini ip2cc lwp-request passwd razor-revoke sa-update srs xpath bdftogd cpan-outdated ea_current_to_profile ipv4calc mojo php README shell-quote srsc chartex cpanp ea_install_profile l4p-tmpl morbo pod_cover rkhunter snmpkey srsd cnv cpanp-run-perl findrule lsphp mysqldiff razor-admin sa-awl spamassassin test-yaml
    Are all those files from my attempted parallel installation? No, I don't think so. php is there, I didn't install php today. I see some ea files. They're not from me. So, how do I undo what I did? I cannot think of a way, besides rebuilding the VPS. If you have a better suggestion, I'll listen. I appreciate you trying to help, but from what I can tell, I messed it up to the point where the easiest option (even though it's not necessarily easy) is to just rebuild the VPS and restore from a backup.
    0
  • Infopro
    Lots of questions. :) Best place to learn about the backup system is via the docs:
    0
  • Spork Schivago
    Lots of questions. :) Best place to learn about the backup system is via the docs: System Backups - Documentation - cPanel Documentation From reading it though, I can tell the backup program to backup specific directories and files by creating a file in the /var/cpanel/backups/extras/ directory. It's not clear from the documentation if I can only specify files or if I can specify directories as well. Also, it's not clear if I have to manually restore those files or if cPanel can restore them. I only have the one VPS through a company called Linode. I can destroy it, rebuild it, but I can't have two of them without paying more money. Because it's a small hard drive, I almost thought of just trying to run rsync over an SSH tunnel or something and trying to copy the majority of the stuff directly to my local hard drive. Then I can systematically go through and restore various things.
    0
  • Infopro
    it's not clear if I have to manually restore those files or if cPanel can restore them.

    Only properly backed up cPanel accounts can be restored via the system you'll be restoring any other system files or directories manually.
    Then I can systematically go through and restore various things.

    That's where all the work is.
    I can't have two of them without paying more money.

    Your time is money too. Purchasing a second server to move to and then killing off the old one 2 days later shouldn't be too cost prohibitive at linode, imho.
    0
  • Spork Schivago
    Only properly backed up cPanel accounts can be restored via the system you'll be restoring any other system files or directories manually.

    Even if I use their /var/cpanel/backups/extras/ feature so cPanel's backup program backs up the other system files / directories that it normally won't backup? For example, if I create a /var/cpanel/backups/extras/letsencrypt file that has in it:
    /etc/letsencrypt
    Then the /etc/letsencrypt directory should get backed up when I run the /scripts/cpbackup script. When I restore though, you're saying /etc/letsencrypt directory will not get restored automatically?
    ...Your time is money too. Purchasing a second server to move to and then killing off the old one 2 days later shouldn't be too cost prohibitive at linode, imho.

    Time is money, and spare time is very short now-a-days. I figured I would be required to have a VPS for 30-days minimum. Maybe I should do it the way you're talking about. Wouldn't using rsync to just download the files to my local PC be just about equivalent though? We don't have a super fast connection here (50Mbps) but it's pretty decent and shouldn't take too long. I'm getting ready for bed. I could just let it run and I bet by tomorrow morning, it'll be done. If it was you, would you just buy the 2nd Linode VPS and do it, or would you use rsync?
    0
  • Infopro
    When I restore though, you're saying /etc/letsencrypt directory will not get restored automatically?

    Correct. From the link you posted above, near the top of the page: cPanel & WHM does not include an interface to restore system backup files. To restore content from system backup files, you must perform the restoration manually.
    If it was you, would you just buy the 2nd Linode VPS and do it,

    If it was me I'd already have the new VPS most of if not all the way setup and by morning, be transferring accounts to it. :) I'm not saying it like that to be rude of course, but this is a disaster recovery 101 teachable moment for you if you look at it correctly. What if your hard drive died instead, here? Are you ready for that? The good news is, it hasn't, you've got time. Moving to a new server, figuring out what you can backup and can't backup and all the steps needs to reconfigure a new server identical to the old one, are all lessons well learned. (Without the stress of a system dropping over dead and customers yelling at you while they wait for your one server to come back online.) Also, unless you've got very large accounts with GBs of files that just need moved, I wouldn't suggest rsyncing things that you might do better to install again from the top instead, and then move your configuration files over manually. You don't want to be copying over any mistakes from the old prod/dev server you're leaving behind.
    I figured I would be required to have a VPS for 30-days minimum.

    Never used linode, don't know how they operate, but I do see they'll rent servers by the hour. You might tell them you're interested in jumping ship on the old server and need a few days grace period to get things setup on a new one. They might have some ideas there for you.
    0
  • Spork Schivago
    Sorry for the delay in responding. We have a little baby now and it's my responsibility to take care of her during the week, minus the evenings. On the weekend, my wife and I will share the responsibilities. Weekends, I get to sleep in. Weekdays, I've been getting around 4 hours of sleep or a so a night. Now that I've had a full night sleep, I'll like to try and explain things a bit more clearly. My system needs to be rebuilt, regardless of whether I destroy the Linode and rebuild it or purchase another VPS and transfer stuff over. I've moved my server from GoDaddy to Linode a while back. Manually downloading all the data and reuploading it is a pain. cPanel backup does not grab all the stuff I need backed up. I have some time to play with this because my server is still functional. My goals are to take this time and develop some sort of automated script that will backup all my pertinent data. I have been downloading the cPanel backup compressed archive files, but I realize this isn't enough. I wanted to use rsync over SSH in a bash script to create a copy of my important data, off my main server, on my local PC. When I said I wanted to use rsync to copy the data, I didn't mean I wanted to use rsync to restore the data. I'm looking for suggestions on what directories / files that I should definitely be grabbing, that the cPanel backup program doesn't grab (for example, /var/cpanel/templates directory might be a good suggestion). Right now, these are the directories / files that my script grabs (including subdirectories, unless otherwise specified):
    /etc/ /root/ /home/ (minus virtfs) /var/ (minus spool) /usr/ (minus /usr/tmpDSK and /usr/tmp)
    I believe the /etc, the /root, and the /home directory are good directories that should be in my backup. But I don't like the idea of just copying the entire /var and /usr directories. The purpose of rsync was to just grab a snapshot of the server in it's current state so I can get my VPS backup and running, and then just slowly comb through the files, fine tuning my script. Does that make sense? Ultimately, it'd be real nice to just take a server that has CentOS 7 installed, with no cPanel, be able to execute a script, and have it copy the cPanel installation back over, with my home directories, etc., and just have it restored. So in the future, if something worse happens, I just run a script and it rebuilds my server.
    0
  • cPanelMichael
    Ultimately, it'd be real nice to just take a server that has CentOS 7 installed, with no cPanel, be able to execute a script, and have it copy the cPanel installation back over, with my home directories, etc., and just have it restored. So in the future, if something worse happens, I just run a script and it rebuilds my server.

    Hello, Companies such as R1Soft offer services that allow you to backup and restore an entire filesystem. I encourage you to open a new feature request if this is something you'd like to see cPanel offer: The cpconftool Script - Documentation - cPanel Documentation This explains how to backup/transfer/restore many of the configuration files that are not included in the account backups. Thank you.
    0
  • germany
    You could set those backups to be sent to a new server as well and restore from there to the new server.
    0

Please sign in to leave a comment.