Backing up Linux servers is crucial if you want to be protected against unexpected failures or data loss.
However, the approach you take to Linux server backups will vary depending on which kind of Linux server you have and what it is used for.
This article identifies the types of files that you would typically back up in different Linux server use cases.
Types of Linux Servers
Linux-based operating systems can be used for many different purposes -- from personal computers and servers to embedded devices.
Moreover, even within the Linux server category, there are several different types of servers that you might use. The three most common Linux server roles are described below, along with tips on how to backup the files on each one.
(Keep in mind that some Linux servers may be used for multiple purposes at once. You may have databases and a Web server running on the same Linux server, for example.)
Backing Up Linux Server Databases
A Linux server that hosts databases usually stores large amounts of data. You’ll want to ensure that data is backed up so it can be recovered in the event that your server fails or the data is corrupted during an attack.
When backing up a database on Linux, it is important not to attempt to copy the database files directly from the server to a backup location. Doing so could lead to data corruption within the backups because databases are not usually designed to be backed up in this way.
Instead, you should use the management or data backup tools that are designed for your database to create a backup of the database's data. For example, for a MySQL database, you could use the mysqldump utility from the command line to “dump” your MySQL data into a static file.
Once you’ve extracted the database data into a file, you can upload it to the cloud using a tool like CloudBerry. Check out here how to upload files to Amazon cloud, for example. If you have large database files, you may want to take advantage of CloudBerry’s advanced multipart upload features. The best way to upload large files to S3 is to use the multipart upload.
If you need to recover the data, you can download the file from the cloud and import the data back into your databases.
Linux Web Server Backups
If you use your Linux server to host websites, you’ll want to back up the website data.
Depending on which Web applications your server hosts, some of the data that they use may be stored in databases. They can be backed up using the approach described above.
However, in almost all cases you will also have static files associated with websites. To back up these files, you can copy them directly from the Web server to a backup location.
In most modern Linux systems, website files are stored in the /var/www directory. On some servers, they may instead be stored in users’ home directories in a location such as /home/username/public_html. The location of website data is determined by the Web server’s configuration, so check the server’s configuration files if you are unsure where all of the data is stored.
You may also find it useful to backup Web server configuration files. They are typically stored in a location such as /etc/apache2, /etc/httpd or /etc/nginx, depending on which type of Web server you use and how it is configured. You may not be able to restore Web server configuration files directly from backups because some configuration files are specific to each server, but the backups will provide a reference point in the event that you need to rebuild your Web server.
Linux File Server Backups
Some Linux servers are used as file repositories. They serve data to other servers or make it available via network shares to individual users.
Ideally, a Linux file server should be configured in such a way that its data is protected against unexpected losses. It might use RAID arrays to ensure that data remains available if a hard disk fails, for example.
However, even if your Linux file server is designed to protect against data loss, you should still backup its data to the cloud on a periodic basis. Remote data backup ensures that you’ll have data from which to recover in the event that the file server is physically destroyed or is attacked and has its data stolen or corrupted.
Linux Backup Security
Storing data on an internal server that is not open to the public Internet is easier from a security standpoint than storing data in the cloud, where it is exposed to more threats.
For this reason, when you backup data from a Linux server to the cloud, you should take extra precautions, including:
- Configure endpoint encryption.
- Ensure that your data is encrypted while it is in transit over the network.
- Encrypt data on the source server wherever possible.
- Lock down access to data storage in the cloud in order to mitigate the risk of unauthorized parties viewing your data.
CloudBerry makes it easy to configure all of these data protections. For more information, check out the resource on how to encrypt files before uploading them to the cloud with CloudBerry and this article on using S3 Server Side Encryption with CloudBerry Explorer.
An effective backup strategy for a Linux server should be customized according to the type of server you are running. It’s also crucial to take steps to secure backup data when you move it from an internal Linux server to the public cloud. Fortunately, CloudBerry makes all of these tasks easy, no matter which type of Linux distribution you use or which types of files and applications your Linux server hosts.
Download Free Whitepaper