Restore data from AWS AMI instance onto CentOS?

Operating System & Version
Amazon Linux AMI 2018.03.0.20200318.2, CentOS 7
cPanel & WHM Version
86.0.18

bonneraaron18

Registered
Apr 17, 2020
2
0
1
Colorado, USA
cPanel Access Level
Root Administrator
Hi all,

Hoo boy, am I in over my head - that's why I'm coming to you for assistance.

Really long story short (details below), my AWS EC2 instance running Amazon Linux AMI that hosted cPanel was terminated without any backups, but I still have the storage volume with (seemingly) intact data. However, I am having immense problems trying to migrate it to my new CentOS EC2 instance. I've tried following a few guides that pertain to crash/hack recovery for cPanel, but with mixed results. Does anyone have a good idea how to get the data from the original drive over to the new server with minimal losses?

And yes, regular snapshots and backups are now on the docket!

Here are some more details:

I had (operative statement) an AWS EC2 instance running Amazon Linux AMI 2018.03.0.20200318.2, which in turn was hosting WHM and cPanel for my websites. That distro is no longer supported, and so I wanted to get onto something new. I stood up a new EC2 instance running CentOS 7, and got WHM/cPanel on it no problem.

Now, when it came to transferring from the old server to the new one, I found I couldn't connect to the old server. For reasons still unknown, I could not SSH into the old server to save my life. I tried various methods of getting SSH access restored, including standing up a temporary EC2 instance and attaching the old drive to it to reset permissions. This did not work, and as I went to terminate the temporary instance, I did not realize that I had also selected my AMI instance to be terminated as well.

The second I realized what happened, I detached the volume, which thankfully was not set to delete upon termination. This leads me to where I am now - I have a shiny clean CentOS server running the latest stable WHM/cPanel, and a drive that was used with a different distro and older cPanel with all my data on it. Admittedly, my Linux skills are...dull...at best, but I know some basic commands and can follow a guide with the best of them. I've tried suggestions such as this guide, but to no avail. While the data seems to have migrated, no accounts are listed and no databases can be found - but if I try to create an account with the same information as on the old server, I receive an error that it already exists.

I would greatly appreciate any and all suggestions!
 
Last edited by a moderator:

GOT

Get Proactive!
PartnerNOC
Apr 8, 2003
1,755
316
363
Chesapeake, VA
cPanel Access Level
DataCenter Provider
Yeah this was a good guide a while back, but it is VERY outdated now and in a couple of cases I see where it would do damage. Specifically, its written with an eye toward easyapache3 and I would imagine your server is likely running easyapache4.

Sadly, I do not really have a good guide to point you to to make this right. You may want to consider opening a ticket with cPanel, their migration team would probably be the best bet. Short of that its a lot of hacking around trying to get things working again.

I should also point out that if your mysql versions are not the same, there is more to it than just syncing the mysql folder. If mysql is running you should at least run
mysql_upgrade

I assume you've ran upcp --force? Sometimes that can fix the display of accounts. Is there the user data in /var/cpanel/users?
 

bonneraaron18

Registered
Apr 17, 2020
2
0
1
Colorado, USA
cPanel Access Level
Root Administrator
Thanks for replying!

Yeah this was a good guide a while back, but it is VERY outdated now and in a couple of cases I see where it would do damage. Specifically, its written with an eye toward easyapache3 and I would imagine your server is likely running easyapache4.
Good to know! I actually started following from the beginning before realizing I was overwriting the fresh cPanel I just installed with my old, janky version, so I wiped everything and started from scratch again, trying to just copy the profiles, databases, etc. And you are correct, the new server is running easyapache4.

I assume you've ran upcp --force? Sometimes that can fix the display of accounts. Is there the user data in /var/cpanel/users?
I had not - again my green-ness coming through. I ran it and it completed, but with some errors, and accounts are still not appearing outwardly. There IS data in /var/cpanel/users, all accounts I had previously had appear to be listed there.
 

GOT

Get Proactive!
PartnerNOC
Apr 8, 2003
1,755
316
363
Chesapeake, VA
cPanel Access Level
DataCenter Provider
Yeah see the problem could easily be that the user data is in a different format from the old version to the new. And in overwriting it it could be irreperably broken.

How many accounts are you talking about? It may make more sense to rebuild by hand.

The other option possibly could be to start the server over and try to install the same version of cPanel as was running on the old server. Then this guide would be more appropriate.