- 追加された行はこの色です。
- 削除された行はこの色です。
Lastmodified &lastmod;
#counter([total|today|yesterday]);
----
Contents
#contents
----
http://www.infoscience.co.jp/technical/rsync/rsync.html#option
----
*rsync [#n87216d0]
初回バックアップ
sent 28,602,292,240 bytes received 3,199,878 bytes 1,112,426.53 bytes/sec
total size is 28,586,529,157 speedup is 1.00
二回目
sent 7,988,547 bytes received 376,646 bytes 123,928.79 bytes/sec
total size is 28,587,054,525 speedup is 3,417.38
三回目w
sent 5,398,911 bytes received 131,592 bytes 165,089.64 bytes/sec
total size is 28,587,204,874 speedup is 5,169.01
*Rsync de backup [#y22e59e5]
**backup スクリプト 2013-04-10 09:41:42 バージョンw [#ybb744ac]
/root/bin/backup2blackhole.sh
#!/bin/sh
/usr/local/bin/rsync -av --inplace --exclude '*.core' --exclude '/usr/Backups/*' --exclude '/usr/ports/*' --delete / blackhole.smb.net:/usr/Backups/hotshot/
**rsyncのちょっといいオプションを知った夏の一日 [#q1d5b35d]
http://blog.livedoor.jp/tuzzy92/archives/52541703.html
その名は --inplace
# man rsync | grep inplace
--inplace update destination files in-place
意味は
ファイルの中身の一部分を変更する場合に、目的のファイルに直接書き込んでしまうことを指示。このオプションが無い場合、一時ファイルを作って完成してから置き換える。ギガ単位の巨大なファイルをバックアップする場合は必須。
※http://omake.accense.com/wiki/LinuxBackupScript より引用
**FreeBSDの準備 [#q0e1fdad]
は、実はあまりない。~
FreeBSDは5.xの頃から、デフォルトではsshdすら起動しない設定だが、これを修正する。
vi /etc/rc.conf
sshd_enable="YES"
とだけ書いておけばいい。デフォルトではパスワード認証を許可しない(公開鍵認証のみ)という、少し厳しめの設定がされていて、通常運用では修正が必要だが、今回はそのままでもいい鴨。
portsから
**rsyncをインストール [#afb324ce]
する必要があるので、
# portinstall net/rsync
しておく。rsyncdを起動する必要もないので、インストール後の設定も不要。至ってシンプルだ。
#ref(rsync_option.gif)
リモートのファイル転送では、プッシュ(被バックアップ側が処理を実行)かプル(バックアップサーバ側が処理を実行)かという実装の選択肢があるが、今回はプッシュで行くことにする。
公開鍵の登録、バックアップ先ディレクトリの設定等を行い、被バックアップ側の各ホストに、バックアップの実行ユーザー(例えば 'backupman')を作成しておいてもよいだろう。
あとは以下のコマンド
/root/bin/backup_to_Guard_all.sh
#!/bin/sh
/usr/local/bin/rsync -av --exclude="/usr/freebsd-update" --delete / guard.kuji-clinic.info:/usr/Backups/Flola_all/
を用意する。
# ./root/bin/backup_to_Guard_all.sh
などとして、動作確認した後、
**crontabに書き込む [#tde4522a]
だけだ。
vi /etc/crontab
# Backup to Piano
30 2 * * * root /root/bin/backup_to_piano.sh
**鍵交換認証 [#n6b51802]
http://phys8.s.chiba-u.ac.jp/nakayamal/machines.html#ssh02
アクセスする側で、
ssh-keygen -b 1024 -t dsa
してid_dsa.pubを作り、アクセス先の~foo/.ssh/へhotshot_id_dsa.pub などとリネームの上コピーし、
% cp hotshot_id_dsa.pub authorized_keys
する。既にauthorized_keys が存在している様なら、
% cat ~/.ssh/hotshot_id_dsa.pub >> ~/.ssh/authorized_keys
% chmod 600 ~/.ssh/authorized_keys
で、追加書き込みになります。
***piano2nd.smb.net のマシンを入れ替えたので・・・ [#p28a12f5]
piano2nd# pwd
/root
piano2nd# ssh-keygen -b 1024 -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
54:30:1f:97:84:61:da:03:a6:bd:d8:7f:16:e0:00:bb root@piano2nd.smb.net
The key's randomart image is:
+--[ DSA 1024]----+
| . =.=+o. |
| * O.o. |
| o = = |
| = + o |
| E S . . |
| . . |
| . o |
| o |
| |
+-----------------+
ns# scp piano2nd:/root/.ssh/id_dsa_piano2nd_2012.pub /root/.ssh/
ssh: piano2nd: No address associated with hostname
ns# scp piano2nd.smb.net:/root/.ssh/id_dsa_piano2nd_2012.pub /root/.ssh/
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the DSA host key has just been changed.
The fingerprint for the DSA key sent by the remote host is
d6:aa:4b:2b:3b:fc:9c:0b:cd:c9:0f:f4:7f:0c:33:50.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:12
DSA host key for piano2nd.smb.net has changed and you have requested strict checking.
Host key verification failed.
ns#
ns#
ns# scp piano2nd.smb.net:/root/.ssh/id_dsa_piano2nd_2012.pub /root/.ssh/
The authenticity of host 'piano2nd.smb.net (219.117.246.211)' can't be established.
DSA key fingerprint is d6:aa:4b:2b:3b:fc:9c:0b:cd:c9:0f:f4:7f:0c:33:50.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'piano2nd.smb.net' (DSA) to the list of known hosts.
Password:
id_dsa_piano2nd_2012 100% |***********************************************| 611 00:00
ns#
**To Do [#k3c49221]
世代バックアップへの対応、ウィルスチェック等が今後の課題か。
マシンAにマシンBでのユーザー情報を追加する作業
http://blog.b-shock.co.jp/pooza/2006/01/freebsd_60.html
http://locs.bw.nitech.ac.jp/~kobayashi/computer.html#fedora03
----
#counter([total|today|yesterday]);
&lastmod;
----