-->
ラベル rsync の投稿を表示しています。 すべての投稿を表示
ラベル rsync の投稿を表示しています。 すべての投稿を表示

2011-05-20

emerge --syncが失敗する

rsyncを再インストールして、/etc/rsyncd.confにuid,gidを追加した。

参考URL。
http://www.itefix.no/i2/node/11817



以下は詳細。

### rsyncがエラーになる。
$ sudo emerge --sync
>>> Starting rsync with rsync://192.168.0.100/gentoo-portage...
>>> Checking server timestamp ...
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(760) [Receiver=3.0.8]
>>> Retrying...
!!! Exhausted addresses for 192.168.0.100

### rsyncサーバー側の再インストール。
$ sudo emerge --oneshot -avt net-misc/rsync
$ sudo /etc/init.d/rsyncd restart

### rsyncクライアント側。
$ rsync -avz 192.168.0.100:~/.bashrc ./
Enter passphrase for key '/home/username/.ssh/id_rsa':
receiving incremental file list
rsync: ../sysdeps/unix/sysv/linux/getpagesize.c:32: __getpagesize: Assertion `_rtld_global_ro._dl_pagesize != 0' failed.
rsync: connection unexpectedly closed (9 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [Receiver=3.0.8]

### rsyncサーバーの再インストール後。
$ rsync -avz 192.168.0.100:~/.bashrc ./
Enter passphrase for key '/home/username/.ssh/id_rsa':
receiving incremental file list
.bashrc

sent 30 bytes  received 1851 bytes  537.43 bytes/sec
total size is 4908  speedup is 2.61

### rsyncサーバー側のglibcを更新している。
$ sudo genlop sys-libs/glibc
     Sun Apr 24 21:29:33 2011 >>> sys-libs/glibc-2.11.3
     Fri May 20 15:12:51 2011 >>> sys-libs/glibc-2.12.2

### 違うエラーになった。
$ sudo emerge --sync
>>> Starting rsync with rsync://192.168.0.100/gentoo-portage...
>>> Checking server timestamp ...
@ERROR: invalid uid nobody
rsync error: error starting client-server protocol (code 5) at main.c(1516) [Receiver=3.0.8]
>>> Retrying...
!!! Exhausted addresses for 192.168.0.100

試しに別のサーバーで/etc/rsyncd.confの設定を変えて、そこにemerge --syncしたところ動作する。

$ rsync -avz 192.168.0.100::gentoo-portage/app-accessibility/SphinxTrain/ .
@ERROR: invalid uid nobody
rsync error: error starting client-server protocol (code 5) at main.c(1516) [Receiver=3.0.8]

$ rsync -avz 192.168.0.200::gentoo-portage/app-accessibility/SphinxTrain/ .
receiving incremental file list
./
...

http://www.itefix.no/i2/node/11817

### uid, gid 追加。
$ rcsdiff -r1.2 /etc/config-archive/etc/rsyncd.conf,v /etc/rsyncd.conf
===================================================================
RCS file: /etc/config-archive/etc/rsyncd.conf,v
retrieving revision 1.2
diff -r1.2 /etc/rsyncd.conf
16a17,18
>       uid = 65534
>       gid = 65534

### nobodyはある。たぶん1000番ぐらいまでしか調べなくなったとか?
$ grep nobody /etc/passwd
nobody:x:65534:65534:nobody:/:/bin/false

2009-12-19

rsync --exclude-from

この記事は rsync --exclude-from=ファイル名 のファイルの設定例です。

一部分だけダウンロードする場合はディレクトリをダウンロードする記述が無いと、その下のファイルを持ってこないです。
- /Documents and Settings/[^/][^/]*/Local Settings/Application Data/Mozilla/Firefox/Profiles/[^/][^/]*/Cache/
- /Documents and Settings/[^/][^/]*/Local Settings/Temporary Internet Files/
- /Program Files/ICW/rsyncd.log
- /pagefile.sys
- /hiberfil.sys
- /RECYCLER/
- /System Volume Information/
+ /WINDOWS/
+ /WINDOWS/pear.ini
+ /WINDOWS/pearsys.ini
+ /WINDOWS/php.ini
+ /WINDOWS/system32/
+ /WINDOWS/system32/drivers/
+ /WINDOWS/system32/drivers/etc/
+ /WINDOWS/system32/drivers/etc/hosts
- /WINDOWS/**

一部のディレクトリのみをダウンロードする場合。
+ /backup/
+ /backup/**
- /**

一部のディレクトリ、ファイルをダウンロードしない場合。
- /System Volume Information/
- /RECYCLER/
- /pagefile.sys

2009-12-09

cwrsync の設定例

colinux の cofs では日本語のみのファイルが扱えないので cwrsync が良いです。
rsyncd.conf
[winC]
path = /cygdrive/c/
read only = true
transfer logging = yes

rsync -a -v rsync://192.168.0.90/winC /mnt/share/winC/`date +%Y-%m-%d`

2回目以降は --link-dest を最新の日付のディレクトリに指定すれば、ほとんどハードリンクになるので、こまめに取れます。
http://www.itefix.no/i2/download の cwrsync (3.4 MB), cwrsync server (3.3 MB) のリンクで windows のサービスが入ります。
(コントロールパネル => 管理ツール => サービス)

この例の場合 winC_2009-12-08 を消すとwinC_2009-12-09が21Gになります。
$ sudo du -sh /mnt/share/backup_tukumo/winC_2009-12-0*
21G     /mnt/share/backup_tukumo/winC_2009-12-08
631M    /mnt/share/backup_tukumo/winC_2009-12-09

更新ファイルが1521個あることがわかります。
$ sudo find /mnt/share/backup_tukumo/winC_2009-12-09/ -links 1 -type f|wc -l
1521

C:\windowsやfirefoxのキャッシュなど対象外を指定した方が良いです。
http://okwave.jp/qa1821032.html
usui@amdgentoo /tmp/rsynctest $ rsync -a -v --list-only rsync://192.168.0.90/winC/Temp/A /tmp/rsynctest/
    receiving incremental file list
    drwx------           0 2009/12/09 15:35:50 A
    drwx------           0 2009/12/09 15:35:36 A/B
    drwx------           0 2009/12/09 15:40:58 A/C
    drwx------           0 2009/12/09 15:41:02 A/C/A
    drwx------           0 2009/12/09 15:41:01 A/C/A/B
    drwx------           0 2009/12/09 15:35:54 A/C/B

    sent 32 bytes  received 161 bytes  128.67 bytes/sec
    total size is 0  speedup is 0.00
    usui@amdgentoo /tmp/rsynctest $ rsync --exclude="/A/B/" -a -v --list-only rsync://192.168.0.90/winC/Temp/A /tmp/rsynctest/
    receiving incremental file list
    drwx------           0 2009/12/09 15:35:50 A
    drwx------           0 2009/12/09 15:40:58 A/C
    drwx------           0 2009/12/09 15:41:02 A/C/A
    drwx------           0 2009/12/09 15:41:01 A/C/A/B
    drwx------           0 2009/12/09 15:35:54 A/C/B

    sent 42 bytes  received 146 bytes  125.33 bytes/sec
    total size is 0  speedup is 0.00

また --list-only でテストした後、実行時には --exclude-from で指定すると良いです。

2009-11-25

windowsとlinuxのrsync

windows 側で colinux をインストールし cofs で c:\ を mount して
linux 側から rsync をしたところ、成功しました。

--link-dest オプションを使う目的で設定しましたが
この方法では日本語ディレクトリで問題が発生します。

cwrsync を使って解決しました。