1. Use root permissions to enter the root directory CD/
2. Perform the following command, back up the system,--exclude= exclude useless files
Tar cvpzf backup.tgz--exclude=/proc--exclude=/lost+found--exclude=/backup.tgz--exclude=/mnt--exclude=/sys/
Simply take a look at this command:
"Tar" is, of course, the program we use to back up our systems.
"CVPFZ" is the tar option, meaning "Create profile", "Keep permissions" (keep everything original), "Use gzip to reduce file size".
"Backup.gz" is the file name of the archive file we are going to get.
"/" is the directory we want to back up, here is the entire file system.
Directories that must be excluded from the backup are given between the file name "backup.gz" and the Directory Name "/" to be backed up. Some directories are useless, such as "/proc", "/lost+found", "/sys". Of course, the "backup.gz" file itself must be excluded, otherwise you may get some out of the ordinary results. If you do not exclude "/mnt", other partitions that are mounted on "/mnt" will also be backed up. Also need to confirm that "/media" does not mount anything (such as CD-ROM, mobile hard disk), if there is a mount thing, must be "/media" also excluded.
3. Use the following command to restore the system:
Tar Xvpfz backup.tgz-c/
4. At the end of the restore command, your work is not complete, and do not forget to recreate the directories that were excluded from the backup:
# mkdir Proc
# mkdir Lost+found
# mkdir MNT
# mkdir SYS
Linux system backup