Explain the way to back up Linux system with tar and the advantages and disadvantages of Clonezilla backup

  

First talk about Clonezilla backup Linux system

There are many backup tools under Linux system, I used Clonezilla before. But there are still some restrictions: 1. It will record the partition of your backup partition in the partition table, for example, I backed up sda6, if I restore to the sda7 partition of other machines, there will be an error message, can not be restored. Of course, this can be avoided by changing the backup file name, the problem is not big. 2. The important problem, if the original partition you backed up is 10GB, and the target partition to be restored later is 8GB, it can't be restored. It prompts partclone to add the “-C” parameter to skip this capacity check. However, Clonezilla is A set of shell file commands, which is a partclone called in the middle, so this parameter is very difficult to add up, at least I did not get it.

The advantages of tar backup system

Based on the above two points, I thought of using tar to back up the system. This is a common method from the Unix era. Basically, it is all-passed. The basic advantages are as follows: 1. Avoid the shortcomings of Clonezilla above, there will be no capacity check problem. Of course, there is no problem that the partition space is not enough when the human is determined to recover. 2. The partition format can be changed. In the case of Clonezilla, what format is the source partition? What is the format of the current partition? If the source is ext4, suddenly you want to change the target to reiserfs, it is impossible, but with tar backup, This can be done, because tar is only a package and unpack file, and will not pay attention to the format of the partition's file system. Of course, the premise is that you must format the target partition before unpacking.

The disadvantages of tar backup Linux system 1. Need a LiveCD, or any way to boot to a basic CLI mode Linux system, because you need to run tar and format the target partition, but this is basically It's easy to do, not a big problem. 2. Speed, Clonezilla backs up my ARCH+KDE system, it only takes 5 minutes. From the generated file, it is also a .gz file, but I don't know why, use tar to backup the same system, and pack it for about half an hour. The speed difference is a lot, but fortunately the general package is once, unpacking is multiple times, and the unpacking speed tar and Clonezilla is similar.

The following is the topic: tar backup Linux system, the specific steps are as follows

First, boot to the basic Linux system, LiveCD available, I personally use grub4dos to boot the archboot ISO image on the U disk .

Second, the source partition is hanged in a directory of the system, usually /mnt, at least I chose this.

Three, execute /ldquo;;tar jcvpf backup.tar.bz2 ./–exclude=files” under /mnt, where backup.tar.bz2 is the name of the backup file, –exclude=files is To exclude files and folders, you should apply multiple –exclude= parameters. The files and directories to be excluded are as follows: 1./mnt/*, of course, you can also directly exclude the /mnt directory. This does not matter 2./Proc/*, this is different from the direct exclusion of the /proc directory on the Internet. I tried it. If the directory is directly excluded, it will affect the startup of ARCH. Other distributions don't know 3./sys/*, ibid., it is recommended to keep the directory. Under 4./tmp/*, this can directly exclude the /tmp directory, but still feel that leaving the directory, excluding the contents of the directory is better 5..opt, this directly excludes the directory on the line, anyway, if there is something to be installed in /Under opt, if the directory does not exist, it will create 6..media/*. This excludes the directory or the contents of the directory. Actually, there is no such thing as 7./var. This /var cannot be completely excluded, but under this directory. Some logs and caches can be excluded, and you can choose your own. In each release, remember to use the respective commands to clear the package before backing up. Otherwise, ……8. The backup file itself, this is silly, but tar does this because you backed up the current directory. Something, and the backup file is in the current directory, so it will add itself, this, do not know what to say.

Four, unpacking, this is used when restoring the system, there is nothing to say, simple tar unpacking instructions will do, the directory partition is formatted first, then mounted to somewhere, directly unpacked Just fine.

Copyright © Windows knowledge All Rights Reserved