In the terminal, enter:
The code is as follows |
Copy Code |
Tar-cvpzf/media/data/linux_bak.tgz–exclude=/proc–exclude=/lost+found–exclude=/media–exclude=/mnt–exclude=/sys/ |
Note: The last/previous one has a space
Media/data/linux_bak.tgz This is the path to my backup file save. Data is another partition on my hard drive, and you can back up the backup files to a network hard disk or on a tape drive.
To restore the system from backup:
The code is as follows |
Copy Code |
TAR-XVPZF/MEDIA/DATA/LINUX_BAK-C/ |
Instance
Here is a simple example of using the tool for data backup:
The code is as follows |
Copy Code |
Tar czvf-/root/code >/tmp/code_bak.tgz (Pack all program files in the/root/code directory back up to/tmp/code_bak.tgz) Tar Xzvf/tmp/code_bak.tgz/root/code (restores the backed-up directory file to the specified directory) |
There is also an order
Dump and restore Introduction
Both dump and restore can be run on the network, so users can back up or restore from a remote device. Dump and restore use tape drives and file devices that provide a wide range of options. However, both are limited to ext2 and Ext3 file systems. If you are using a JFS, Reiser, or other file system, you will need additional utilities, such as tar. As an example:
code is as follows |
copy code |
dump 0f/dev/ Nst0/(Back up the ext2 file system to the first SCSI device) Restore-xf/dev/nst0/home/code (Restore all data from the/home/code directory in the backed up SCSI device to disk) | /tr>