sh 备份服务器使用Tar

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 备份服务器使用Tar相关的知识,希望对你有一定的参考价值。

sudo tar cvpzf /backup_`date '+%Y-%m-%d'`.tar.gz --exclude=/backup_`date '+%Y-%m-%d'`.tar.gz --one-file-system /

## -cvpzf
# c: new archive
# v: verbose (= shows an output while it is compressing)
# p: keep permissions inside the archive intact
# z: gzip compression mode. It is recommend against writing compressed data to 
#    tape, because if data on a portion of the tape becomes corrupted, you will 
#    lose your entire backup set
# f: allows to name the file

## /backup.tar.gz
# Destination and name of the backup archive.

## --exclude=/backup.tar.gz
# Prevent backup from being included in backup

## --one-file-system
# Exclude certain directories (e.g. prog, sys, run, deb, ...) that are generated
# dynamically by the running cernel

## /
# Path that we want to backup (entire root directory in this case)
sudo tar xvpzf /path/to/backup.tar.gz -C /directory/to/restore/to --numeric-owner

## /directory/to/restore/to
# Will overwrite already existing files

以上是关于sh 备份服务器使用Tar的主要内容,如果未能解决你的问题,请参考以下文章

sh 用tar备份和恢复linux操作系统

sh 使用mongodump,tar和awscli自动将MongoDB数据库备份到S3(Ubuntu 14.04 LTS)

sh 使用mongodump,tar和awscli自动将MongoDB数据库备份到S3(Ubuntu 14.04 LTS)

sh 使用mongodump,tar和awscli自动将MongoDB数据库备份到S3(Ubuntu 14.04 LTS)

sh 使用mongodump,tar和awscli自动将MongoDB数据库备份到S3(Ubuntu 14.04 LTS)

sh 使用mongodump,tar和awscli自动将MongoDB数据库备份到S3(Ubuntu 14.04 LTS)