The simplest method is to compress all the files in the/directory into a compressed package. You need to decompress the package and overwrite the package.
First, make sure it is the root user.
Then run the command to package the files in the/directory.
Tar cvpzf backup. tgz -- exclude =/proc -- exclude =/lost + found -- exclude =/backup. tgz -- exclude =/mnt -- exclude =/sys/
For more information about cvpzf, see the help of the tar command:
Cf is used to create a tar file (F refers to an archive file, usually used for cf or ZF). Z refers to gzip compression and V refers to verbose. the creation process is detailed, P indicates that the File Permission remains unchanged.
Okay, my backup file backup. tgz has been created, 652 m.
If you encounter any problems later, you can use the following command to restore them.
Tar xvpfz backup. tgz-C/
X indicates decompression, V, p, and Z. -C: Decompress the file to the/directory.
Reference:
Http://ubuntuforums.org/showthread.php? T = 35087