ローカルディスクへの1日に1回のフルバックアップと、
1時間に1回の差分バックアップは出来たが、
それだけではディスクがクラッシュしてしまうと復元できない。
リモートマシンへバックアップを取る。
root@xhl:~# vi /etc/rsyncd.conf
:
:
root@xhl:~# cat !$
cat /etc/rsyncd.conf
[Backup]
path = /mnt/Backup
hosts allow = 192.168.1.0/24 192.168.2.0/24
[httpd]
path = /home/httpd
hosts allow = 192.168.1.0/24 192.168.2.0/24
root@xhl:~#
バックアップの対象は、
root@xhl:~# grep rsync /etc/inetd.conf
root@xhl:~# mv /etc/inetd.conf{,.orig}
root@xhl:~# cp /etc/inetd.conf{.orig,}
root@xhl:~# echo "rsync stream tcp nowait root /usr/sbin/tcpd /usr/bin/rsync --daemon" >> /etc/inetd.conf
root@xhl:~#
root@xhl:~# kill -HUP `cat /var/run/inetd.pid ` root@xhl:~#
yasunari@qube:~$ vi /usr/local/sbin/Backup.to.qube
yasunari@qube:~$ cat !$
cat /usr/local/sbin/Backup.to.qube
#! /bin/sh
makedir(){
if [ ! -d $BACKUPDIR ]
then
mkdir -p $BACKUPDIR
chown yasunari.yamasita $BACKUPDIR
chmod 4775 $BACKUPDIR
fi
cd $BACKUPDIR
}
LOCKFILE=/tmp/`basename $0`
if [ -f $LOCKFILE ]
then
echo $0 already running
exit
fi
touch $LOCKFILE
LED=/proc/buffalo/gpio/led/pm_diag_led3
echo on > $LED
if [ `whoami` = "root" ]
then
SH="su yasunari"
else
SH=sh
fi
web()
{
BACKUPDIR=/mnt/Backup/httpd
makedir
echo ts/httpd
$SH -c "nice rsync -rtuvpogtlH rsync://xhl/httpd ."
}
other()
{
cd /mnt
for SRCHOST in qvl link giga sil av xhl ns tswxl # mt kuro ude
do
echo
echo $SRCHOST
echo
$SH -c "nice rsync -rtuvpogtlH --timeout=600 rsync://$SRCHOST/Backup Backup/linkstation"
done
}
#-------------------------------------
web
other
#-------------------------------------
rm -f $LOCKFILE
echo off > $LED
yasunari@qube:~$
yasunari@qube:~$ sh /usr/local/sbin/Backup.to.qube /var/tmp/Backup.to.qube: 22: cannot create /proc/buffalo/gpio/led/pm_diag_led3: Permission denied ts/httpd receiving incremental file list ./ cgi-bin/ cannot delete non-empty directory: cgi-bin/mt could not make way for new symlink: cgi-bin/mt rsync: send_files failed to open "/cgi-bin/MT-6_0_5.zip" (in httpd): Permission denied (13) : : html/linkstation/2014/10/ html/linkstation/2014/10/141030_post_398.html html/linkstation/2014/10/141031_post_399.html html/linkstation/2014/10/index.html html/linkstation/2014/11/ html/linkstation/category/debian/ html/linkstation/category/lsxhl/ html/linkstation/category/lsxhl/index.html sent 99132 bytes received 55414419 bytes 368860.80 bytes/sec total size is 10793026625 speedup is 194.42 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1526) [generator=3.0.7] qvl receiving incremental file list ./ sent 33 bytes received 3285 bytes 2212.00 bytes/sec total size is 1715487866 speedup is 517024.67 link rsync: failed to connect to link: No route to host (113) rsync error: error in socket IO (code 10) at clientserver.c(122) [Receiver=3.0.7] giga rsync: failed to connect to giga: No route to host (113) rsync error: error in socket IO (code 10) at clientserver.c(122) [Receiver=3.0.7] sil receiving incremental file list ./ sent 33 bytes received 3272 bytes 2203.33 bytes/sec total size is 8109238915 speedup is 2453627.51 av receiving incremental file list ./ httplog/ ns/ ns/ns.1410/ sent 48 bytes received 11238 bytes 7524.00 bytes/sec total size is 7457260163 speedup is 660753.16 xhl receiving incremental file list ./ xhl/ xhl/xhl.1410/ xhl/xhl.1410/xhl-bin.Fri.tar.gz xhl/xhl.1410/xhl-boot.Fri.tar.gz xhl/xhl.1410/xhl-etc.Fri.tar.gz xhl/xhl.1410/xhl-initrd.Fri.tar.gz xhl/xhl.1410/xhl-lib.Fri.tar.gz xhl/xhl.1410/xhl-media.Fri.tar.gz xhl/xhl.1410/xhl-mysql.Fri.gz xhl/xhl.1410/xhl-opt.Fri.tar.gz xhl/xhl.1410/xhl-root.Fri.tar.gz xhl/xhl.1410/xhl-sbin.Fri.tar.gz xhl/xhl.1410/xhl-selinux.Fri.tar.gz xhl/xhl.1410/xhl-sys.Fri.tar.gz xhl/xhl.1410/xhl-usr.Fri.tar.gz xhl/xhl.1410/xhl-var.Fri.tar.gz xhl/xhl.1411/ xhl/xhl.1411/xhl-bin.Sat.tar.gz xhl/xhl.1411/xhl-boot.Sat.tar.gz xhl/xhl.1411/xhl-etc.Sat.tar.gz xhl/xhl.1411/xhl-initrd.Sat.tar.gz xhl/xhl.1411/xhl-lib.Sat.tar.gz xhl/xhl.1411/xhl-media.Sat.tar.gz xhl/xhl.1411/xhl-mysql.Sat.gz xhl/xhl.1411/xhl-opt.Sat.tar.gz xhl/xhl.1411/xhl-root.Sat.tar.gz xhl/xhl.1411/xhl-sbin.Sat.tar.gz xhl/xhl.1411/xhl-selinux.Sat.tar.gz xhl/xhl.1411/xhl-sys.Sat.tar.gz xhl/xhl.1411/xhl-usr.Sat.tar.gz xhl/xhl.1411/xhl-var.Sat.tar.gz sent 578 bytes received 430210335 bytes 6883374.61 bytes/sec total size is 7397872623 speedup is 17.20 ns receiving file list ... done ./ sent 87 bytes received 4564 bytes 3100.67 bytes/sec total size is 3679651658 speedup is 791152.80 tswxl receiving incremental file list ./ httplog/ ns/ ns/ns.1410/ sent 49 bytes received 13079 bytes 8752.00 bytes/sec total size is 11936385524 speedup is 909231.07 /var/tmp/Backup.to.qube: 59: cannot create /proc/buffalo/gpio/led/pm_diag_led3: Permission denied yasunari@qube:~$一般ユーザで実行しているので LED 制御は失敗しているが、 それ以外はOK
yasunari@qube:~$ sudo crontab -l | grep Backup.to.qube [sudo] password for yasunari: 5,20,35,50 * * * * nice /bin/sh /usr/local/sbin/Backup.to.qube 2>/dev/null 1>/dev/null yasunari@qube:~$これで1時間に4回、更新があればリモートバックアップする
|
|
← 差分バックアップ |
ハックの記録 LinkStation/玄箱 をハックしよう |
→ LinkStationシリーズ ファームウェア アップデーター Ver.1.70 |
Copyright (C) 2003-2015 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市