Linux data backup usually uses the tar command. It is difficult for beginners to understand the complicated Linux data backup solution. This article introduces a "silly backup solution" for users who are new to Linux servers.
1. First, we need to know what data needs to be backed up.
Generally, the database and website data are included. In this example, the database is located in the/var/lib/mysql/directory, and the website is located in the/www/users/directory.
2. determine where to back up data and create a directory in this partition.
Select a partition with a large space, for example,/var.
Type the following command:
Cd/var
Mkdir backup
3. After creating the Backup Directory, go to the backup directory.
Cd/var/backup
4. Generally, the database should be completely backed up. We recommend that you name each backup as the current date.
Tar-czvf mysql20051015.tar.gz/var/lib/mysql /*
This command generates a backup in the current directory. The backup content is all the content in the/var/lib/mysql/directory.
5. If there is not much website data, you can completely back up the website data each time.
Tar-czvf users20051015.tar.gz/www/users /*
6. If there is a large amount of website data, especially for systems with a large volume of Files updated every day, such as website E-access and mall operations, we recommend that you perform full backup once a month and update the backup once every day or every week. This backup method is called "differential backup". Differential backup requires that each updated backup be based on the last full backup time.
For example, a full backup will be performed on January 1, October 15:
Tar-czvf users20051015.tar.gz/www/users /*
Before the next full backup, perform an update backup for the full backup on January 1, October 15, for example, once a week ):
Tar-czvf users20051015.tar.gz/www/users/* -- newer 10/15/2005/
After "differential backup", if you need to recover data, you should first restore the full backup, and then overwrite the latest update backup.
I hope this Linux data backup solution is relatively simple and helpful for beginners.
- In-depth analysis of Linux system startup II)
- Linux system startup depth analysis 1)
- Detailed introduction to Linux hardware information commands
- Common LinuxYUM commands
- One of the methods to modify the default Linux Startup System