SOLVED Restoring selected data on a new server

ddaddy

Well-Known Member
Aug 19, 2015
60
11
58
UK
cPanel Access Level
Root Administrator
Hi,
My webhost have had issues and lost all recent data. After a week of downtime, they still haven't got servers back up and running.
I had already setup an AWS instance running WHM/CPanel and got most of my sites back up and running and I will be using this from now on.

I've since been supplied a raw system backup from a week prior to the incident and I want to restore certain things into my new system.

Emails:
I understand I can just copy the <user>/mail/<url>/<emailuser>/cur folders over and chown the files to the <user> for the old emails to be available again.
There's a few domains/mailboxes I haven't set back up yet as I need to keep the email passwords the same. Should I create the mail boxes as new accounts then copy over some additional files to replace the passwords? Or is there an easier way?

<EDIT> I see there is actually hidden folders for .Send, .Trash, .Drafts etc.. So I copy these hidden folders and the /cur folder for each mailbox. However I have noticed when my mailbox syncs, all emails have the same date/time. Where is this information stored for me to copy over?

Are there some files that contain my old email filters? I had quite an extensive collection of global email filters that blocked a lot of spam.

DNS:
Where can I find DNS records? I'd like to go through the old ones to double check I haven't missed anything as I have some records that point to external servers.

Sites:
One of the sites I haven't setup yet was a Wordpress site. This obviously uses a database. Is there an easy way to copy over the database and access credentials for the site so it will just work without me having to edit the configs? If not, then what would be the best way to set up the site and move the data? I'm fine with a 'replace all databases' solution as I haven't set any up on my new system yet and would rather just get the old ones back.


All the sites were listed under 1 CPanel account. Any help would be appreciated.
Thanks
 
Last edited:

ffeingol

Well-Known Member
PartnerNOC
Nov 9, 2001
616
198
343
cPanel Access Level
DataCenter Provider
DNS information will be in /var/named Each domain will have a file in the format domain.tld.db. It's just a text file (in bind format) so it's quite easy to look at / compare to what you have.

Databases will be a lot more complicated. The actual database files are stored in /var/lib/mysql/DATABASENAME The problem is that they are stored the way that MySQL wants them and you can't directly access those files. The second issue is the storage engine used. If in they are myisam then everything is stored in the database folder. If they are innodb it's more complicated.

Can your host provide any cPanel backups instead of a raw system backup? a cPanel backup would have the database in mysql dump format (basically create table / insert data) and that is much easier to recover from.
 

ddaddy

Well-Known Member
Aug 19, 2015
60
11
58
UK
cPanel Access Level
Root Administrator
Thanks for your reply.
There is an additional folder of backups that look like they were created separately as they contain folders like /dnszones which has all my DNS records. /homedir which has all my html data and there's one called /mysql which has files for the account I want to restore the db called .create and .sql
I take it I can use these to recreate the database schemas and data?

Any suggestions on copying the mail accounts with passwords?
 

ffeingol

Well-Known Member
PartnerNOC
Nov 9, 2001
616
198
343
cPanel Access Level
DataCenter Provider
That actually sounds like a cPanel backup. For the MySQL all you need are the .sql files. Create the databases/users via cPanel and then you can use phpmyadmin to import the .sql file into the database.

From memory, email passwords should be in /homedir/etc/domain.tld/etc passwd will have the mailbox names and shadow will have the hashes/salted passwords. The passwords are really not of much use as they are in their encrypted (hashed/salted) format.
 

ddaddy

Well-Known Member
Aug 19, 2015
60
11
58
UK
cPanel Access Level
Root Administrator
Thank you. I don't need to see the passwords, I just need the mailboxes to continue to work on peoples devices without me having to get them to change the email password.
Can I copy over the emails and passwords and the account will appear in CPanel, or should I recreate the mailbox first with the same username, then copy over the password files and emails?
 

ffeingol

Well-Known Member
PartnerNOC
Nov 9, 2001
616
198
343
cPanel Access Level
DataCenter Provider
Personally I'd create the mailboxes in cPanel and then try to copy things over. The shadow file is a colon ( : ) delimited file. the first field is the mailbox name and the second is the hashed password. That file is not really intended to be hand edited so YMMV if it works or not. You'll be able to tell if you look at the file /var/log/maillog In that file you'll see successful / unsuccessful IMAP/POP email logins.

For future reference (it sounds like you way to far down the line of manually restoring) that file that you have is a cpanel backup. cPanel support could have guided you as to where to upload it and then you would have just been able to use the WHM restore functionality and you would have been done.
 

ddaddy

Well-Known Member
Aug 19, 2015
60
11
58
UK
cPanel Access Level
Root Administrator
Thank you for the help. Everything is back to normal and working great :)

Unfortunately, my web host has not been very helpful at all! In fact, it's been the worst customer service I have ever received!
After routine maintenance, they had issues which is understandable. However a lack of updates on the situation and open ended "We're working on it" claims have been extremely frustrating. Today is day 8 and my server is still offline with the last update 4 days ago.

I took it on myself to get an AWS server up and running to get some websites back up and emails working again.

I've spoken with several other clients of theirs that have lost out on a lot of money due to having their servers offline over black friday.

Sorry about the rant, but thanks again for your help.
 
Last edited by a moderator: