[Linux]rsync備份機制
以下以Debian為操作環境。
**放備份資料的主機(Server)
1.安裝
apt-get install rsync
2.改預設值
vi /etc/default/rsync
將RSYNC_ENABLE=false
改成RSYNC_ENABLE=true
3.改設定檔
vi /etc/rsyncd.conf
[Home_bk_1]
path = /home_bk_1 // 備份路徑
auth users = hbk1 // 帳號
uid = root
gid = root
secrets file = /etc/rsyncd.secrets // 密碼檔
read only = no
4.設定帳號密碼
vi /etc/rsyncd.secrets
home_bk_1:rsync4ever // 帳號:密碼
5.修改權限和擁有者
chown root:root /etc/rsyncd.secrets
chmod 600 /etc/rsyncd.secrets
6.啟動rsync
/etc/init.d/rsync start
**要備份的主機(Client)
1.安裝
apt-get install rsync
2.設定密碼
vi /etc/rsyncd.passwd
rsync4ever // 僅需密碼
3.修改權限與擁有者
chown root:root /etc/rsyncd.passwd
chmod 600 /etc/rsyncd.passwd
4.開始備份
rsync -arHz --progress --delete --password-file=/etc/rsyncd.passwd /home hbk1@xxx::Home_bk_1
-a:保留權限,除了 Hard Link
-r:遞迴地複製目錄中的所有子目錄
-H:保留 Hard Link
-z:資料備份前先壓縮
--progress:顯示進度
--delete:如果要備份的Client上刪除了某個檔案,備份的Server也刪除某個檔案
--password-file:密碼檔的位置
5.自動化
vi /etc/crontab
0 5 * * * root /usr/bin/rsync -arHz --progress --delete --password-file=/etc/rsyncd.passwd /home hbk1@xxx::Home_bk_1
**資料的還原
1.直接在要還原資料的電腦執行rsync還原
rsync -arHz --progress --delete --password-file=/etc/rsyncd.passwd hbk1@xxx::Home_bk_1 /home
–參考Rostin's pLog及臥龍小三網路管理技術文件
這篇屁話被收在分類:
哩哪係0 則引用
本篇屁話的引用連結 : http://thecrap.org/mt-tb.cgi/70
引用 [Linux]rsync備份機制 的文章如下 :

這個是你提到的兩台同步資料的方法嗎?
是滴