In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian introduces in detail how to use the tar command to back up and restore the Linux system ", the content is detailed, the steps are clear, and the details are handled properly. I hope this" how to use the tar command to back up and restore the Linux system "article can help you solve your doubts.
The Linux tar (English spelling: tape archive) command is used to back up files. Tar is a tool used to create and restore backup files. It can join and unlock the files in the backup files.
Backup
Open the terminal and switch to the root state
Sudo su
Enter the system "/" directory
Execute the packaging command (exclude=/ is followed by the folder you want to exclude when backing up)
Cd / tar cvpzf Deepinbackup.tgz-- exclude=/proc-- exclude=/mnt-- exclude=/lost+found-- exclude=/sys-- exclude=/media-- exclude=/run-- exclude=/Deepinbackup.tgz / incremental backup
Many systems (applications or websites) produce static files every day. If there is a need for regular backup of some important static files, you can pack and compress the backup to a designated place through tar, especially for some cases where the total file is larger and more, you can also use the-g option to do incremental backup.
It is best to use a relative path to the backup directory, that is, to go to the root directory that needs to be backed up
The specific example method is as follows.
Back up all files in the current directory # tar-g / tmp/snapshot_data.snap-zcpf / tmp/data01.tar.gz. Extract the recovery # tar-zxpf / tmp/data01.tar.gz-C.
The-g option allows you to take a snapshot of the directory file and record permissions and attributes during the backup. "/ tmp/snapshot_data.snap" does not exist at the first backup, so a new one will be created and a full backup will be made. When the files in the directory have been modified, execute the first backup command again (remember to modify the following file name), and will automatically back up the modified files incrementally according to the snapshot file specified by-g, including permissions and attributes. Files that have not been touched will not be backed up repeatedly.
It is also important to note that the above restore is "reserved restore", that is, files with the same file name will be overwritten, while those that already exist in the original directory (but not in the backup file) will remain. So if you want to fully restore to exactly the same as the backup file, you need to empty the original directory. If you have incremental backup files, you need to extract them separately in the same way, and pay attention to the order.
Restore tar xvpfz Deepinbackup.tgz-C /
Create the directory that was just excluded during the backup (depending on the actual situation)
Mkdir procmdkir lost+foundmkdir mntmkdir sysmkdir mediamkdir run restart the system, restore completed read here, this "how to use tar command backup restore Linux system" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more related articles, welcome to pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.