How to backup root server with online shop

Hi,
how can I backup my entire root server (UBUNTU 16)? It is hosted at MITTWALD. It is installed and configured (MAGENTO shop), now I want to backup the whole server with the possibility to restore it easily. I am not sure what is the best way to do this and I hope to get some good ideas.
Info: From the hosters console it is not possible to create backups.

Thank you!
Rio ReiserAsked:
Who is Participating?
 
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Simple way is to dump your database...

cd /your-site-docroot
mysqldump --defaults-file=/etc/mysql/debian.cnf --default-character-set=utf8 --opt --routines --triggers --events > db.sql

cd ..
zip -y -s -r -7 site.zip your-site-docroot

Open in new window


Then copy your site.zip files off your server each night.

I timestamp my backups for clients. If you're running pure Linux then use tar -Ipixz instead of zip.
0
 
Rio ReiserAuthor Commented:
ahh thanks seems to be simple. Anyway:
- Do I use the "debian.cnf" also with UBUNTU?
- When zipping, do I also include permissions?
- How to restore the files?

I appreciate your help!
0
 
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Yes, use /etc/mysql/debian.cnf with Ubuntu.

Zip includes permissions + drops all ACLs/XATTRs, so if you use many complex ACLs, likely best to use tar -Ipixz instead of zip.

To restore, use unzip for .zip files + tar -xf for tar files.

You're welcome!
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Rio ReiserAuthor Commented:
Brilliant thank you David.
Just one question left: How do I best restore the database?

Thanks in advance!
0
 
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
You're welcome.

To restore a database...

1) Create an empty database, remember to create correct GRANTs based on your database version (see your docs).

2) Then use your choice of load commands. I usually use pv, as I like to ensure I see the progress of a database load.

Using pv you can quickly see problems. For example, I once had a WordPress database using the Pretty Links plugin (shudder) + load time estimate was 40+ hours.

pv your.sql | mysql --defaults-extra-file=/etc/mysql/debian.cnf --default-character-set=utf8 your-empty-database

Open in new window


Enjoy!
0
 
Rio ReiserAuthor Commented:
Thank you David
0
 
Rio ReiserAuthor Commented:
Very helpful
0
 
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
You're welcome!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.