[daily][archlinux][rsync] rsync

 

科普文檔:https://wiki.archlinux.org/index.php/Rsyncphp

以前改文件系統時,用過。 然而用的不太對,致使一部分文件的權限出了問題。html

[troubleshoot][archlinux][bcache] 修改linux文件系統 / 分區方案 / 作混合硬盤 / 系統轉生大!手!術!(調整底層架構,不!重!裝!)

使用rsync作全系統備份的教程:https://wiki.archlinux.org/index.php/Full_system_backup_with_rsynclinux

 

一,在備份server上啓動 rsync服務。固然不啓動也行,由於能夠使用ssh。c#

man rsyncd.conf

  高不太清楚怎麼用,好像也沒有必要配。直接ssh。bash

二,經過ssh使用rsync,參考架構

  還參考了仙子的 舊文章ssh

/home/tong [tong@T7] [11:44]
> sudo pacman -S rsync

 

三, 寫了個腳本,來使用。post

/home/tong [tong@T7] [19:07]
> cat bin/rsync-t7
#! /usr/bin/bash
 
cd $(dirname $0)

if [[ $# -lt 0 || $# -gt 1 ]]; then
        echo "usage: $0 [-w]"
        exit 1
fi

src=/
dest=tong@192.168.10.50:/home/tong/Data/Bak/T7-rsync/ROOT_FS
doit=$1
 
if [[ $doit == -w ]]; then
        dry=
else
        dry='-n'
fi
 
sudo rsync --archive --acls --xattrs --numeric-ids\
        --delete \
        --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} \
        --sparse \
        --hard-links \
        --human-readable --itemize-changes --progress \
        --verbose \
   -M--fake-super \ $src $dest $dry #
--delete-excluded # --one-file-system \

 

其中: --one-file-system  會致使單獨掛在的/home分區和/boot分區不能被同步。url

-----------  update @ 20170701 --------------spa

以上的腳步在實際使用中,發現了一個問題。

T7使用的是root用戶,Tstation(192.168.10.50)使用的tong用戶登陸。這樣的話,實際上就丟失了文件的全部者信息。

能夠在遠端-M增長--fake-super命令來解決這一問題。 

而後從遠端(Tstation)同步回來(T7)的時候,使用相同的命令便可。

詳細參見 man rsync  fake-super章節。

 

-----------  update @ 20180531 ----------

在本地sync的時候,-M--fake-super會致使軟鏈接copy以後變成文件。緣由不清楚。

[root@nlbtest tong]# rsync --archive --acls --xattrs --numeric-ids --delete --sparse --hard-links --human-readable --itemize-changes -M--fake-super ./src/ ./dst
.d..t.....x ./
cL+++++++++ bin -> usr/bin/
.d........x usr/
.d........x usr/bin/
[root@nlbtest tong]# ll dst/
total 12
-rwxrwxrwx. 1 root root  8 May 31 13:52 bin
drwxr-xr-x. 3 root root 16 May 31 13:52 usr
[root@nlbtest tong]# 
相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息