2012秋のファイルサーバ復旧 10 SVN設定とOSバックアップ

残っているのはあとSVNだけです。
yumでインストールします。



# yum install subversion
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * Webmin: download.webmin.com
 * base: rsync.atworks.co.jp
 * extras: ftp.iij.ad.jp
 * updates: rsync.atworks.co.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package subversion.i386 0:1.6.11-10.el5_8 set to be updated
--> Processing Dependency: perl(URI) >= 1.17 for package: subversion
--> Processing Dependency: neon >= 0.25.5-6.el5 for package: subversion
--> Processing Dependency: libneon.so.25 for package: subversion
--> Processing Dependency: libapr-1.so.0 for package: subversion
--> Processing Dependency: libaprutil-1.so.0 for package: subversion
--> Processing Dependency: libldap-2.3.so.0 for package: subversion
--> Processing Dependency: libdb-4.3.so for package: subversion
--> Processing Dependency: libsasl2.so.2 for package: subversion
--> Processing Dependency: liblber-2.3.so.0 for package: subversion
---> Package subversion.x86_64 0:1.6.11-10.el5_8 set to be updated
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: subversion
--> Processing Dependency: libapr-1.so.0()(64bit) for package: subversion
--> Running transaction check
---> Package apr.i386 0:1.2.7-11.el5_6.5 set to be updated
---> Package apr.x86_64 0:1.2.7-11.el5_6.5 set to be updated
---> Package apr-util.i386 0:1.2.7-11.el5_5.2 set to be updated
--> Processing Dependency: libsqlite3.so.0 for package: apr-util
--> Processing Dependency: libpq.so.4 for package: apr-util
---> Package apr-util.x86_64 0:1.2.7-11.el5_5.2 set to be updated
--> Processing Dependency: libpq.so.4()(64bit) for package: apr-util
---> Package cyrus-sasl-lib.i386 0:2.1.22-7.el5_8.1 set to be updated
---> Package cyrus-sasl-lib.x86_64 0:2.1.22-7.el5_8.1 set to be updated
---> Package db4.i386 0:4.3.29-10.el5_5.2 set to be updated
---> Package neon.i386 0:0.25.5-10.el5_4.1 set to be updated
---> Package neon.x86_64 0:0.25.5-10.el5_4.1 set to be updated
---> Package openldap.i386 0:2.3.43-25.el5_8.1 set to be updated
---> Package openldap.x86_64 0:2.3.43-25.el5_8.1 set to be updated
---> Package perl-URI.noarch 0:1.35-3 set to be updated
--> Running transaction check
---> Package postgresql-libs.i386 0:8.1.23-6.el5_8 set to be updated
---> Package postgresql-libs.x86_64 0:8.1.23-6.el5_8 set to be updated
---> Package sqlite.i386 0:3.3.6-5 set to be updated
--> Processing Dependency: libncurses.so.5 for package: sqlite
--> Running transaction check
---> Package ncurses.i386 0:5.5-24.20060715 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================
 Package                                    Arch                              Version                                        Repository                          Size
======================================================================================================================================================================
Installing:
 subversion                                 i386                              1.6.11-10.el5_8                                updates                            3.1 M
 subversion                                 x86_64                            1.6.11-10.el5_8                                updates                            3.2 M
Installing for dependencies:
 apr                                        i386                              1.2.7-11.el5_6.5                               base                               124 k
 apr                                        x86_64                            1.2.7-11.el5_6.5                               base                               119 k
 apr-util                                   i386                              1.2.7-11.el5_5.2                               base                                80 k
 apr-util                                   x86_64                            1.2.7-11.el5_5.2                               base                                79 k
 cyrus-sasl-lib                             i386                              2.1.22-7.el5_8.1                               updates                            126 k
 db4                                        i386                              4.3.29-10.el5_5.2                              base                               910 k
 ncurses                                    i386                              5.5-24.20060715                                base                               1.1 M
 neon                                       i386                              0.25.5-10.el5_4.1                              base                               101 k
 neon                                       x86_64                            0.25.5-10.el5_4.1                              base                               100 k
 openldap                                   i386                              2.3.43-25.el5_8.1                              updates                            298 k
 perl-URI                                   noarch                            1.35-3                                         base                               116 k
 postgresql-libs                            i386                              8.1.23-6.el5_8                                 updates                            197 k
 postgresql-libs                            x86_64                            8.1.23-6.el5_8                                 updates                            197 k
 sqlite                                     i386                              3.3.6-5                                        base                               213 k
Updating for dependencies:
 cyrus-sasl-lib                             x86_64                            2.1.22-7.el5_8.1                               updates                            130 k
 openldap                                   x86_64                            2.3.43-25.el5_8.1                              updates                            306 k

Transaction Summary
======================================================================================================================================================================
Install      16 Package(s)
Upgrade       2 Package(s)

Total download size: 11 M
Is this ok [y/N]: y
Downloading Packages:
(1/18): apr-util-1.2.7-11.el5_5.2.x86_64.rpm                                                                                                   |  79 kB     00:00
(2/18): apr-util-1.2.7-11.el5_5.2.i386.rpm                                                                                                     |  80 kB     00:00
(3/18): neon-0.25.5-10.el5_4.1.x86_64.rpm                                                                                                      | 100 kB     00:00
(4/18): neon-0.25.5-10.el5_4.1.i386.rpm                                                                                                        | 101 kB     00:00
(5/18): perl-URI-1.35-3.noarch.rpm                                                                                                             | 116 kB     00:00
(6/18): apr-1.2.7-11.el5_6.5.x86_64.rpm                                                                                                        | 119 kB     00:00
(7/18): apr-1.2.7-11.el5_6.5.i386.rpm                                                                                                          | 124 kB     00:00
(8/18): cyrus-sasl-lib-2.1.22-7.el5_8.1.i386.rpm                                                                                               | 126 kB     00:00
(9/18): cyrus-sasl-lib-2.1.22-7.el5_8.1.x86_64.rpm                                                                                             | 130 kB     00:00
(10/18): postgresql-libs-8.1.23-6.el5_8.x86_64.rpm                                                                                             | 197 kB     00:00
(11/18): postgresql-libs-8.1.23-6.el5_8.i386.rpm                                                                                               | 197 kB     00:00
(12/18): sqlite-3.3.6-5.i386.rpm                                                                                                               | 213 kB     00:00
(13/18): openldap-2.3.43-25.el5_8.1.i386.rpm                                                                                                   | 298 kB     00:00
(14/18): openldap-2.3.43-25.el5_8.1.x86_64.rpm                                                                                                 | 306 kB     00:00
(15/18): db4-4.3.29-10.el5_5.2.i386.rpm                                                                                                        | 910 kB     00:00
(16/18): ncurses-5.5-24.20060715.i386.rpm                                                                                                      | 1.1 MB     00:00
(17/18): subversion-1.6.11-10.el5_8.i386.rpm                                                                                                   | 3.1 MB     00:00
(18/18): subversion-1.6.11-10.el5_8.x86_64.rpm                                                                                                 | 3.2 MB     00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                 2.3 MB/s |  11 MB     00:04
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : cyrus-sasl-lib                                                                                                                                1/20
  Updating       : openldap                                                                                                                                      2/20
  Installing     : neon                                                                                                                                          3/20
  Installing     : apr                                                                                                                                           4/20
  Installing     : db4                                                                                                                                           5/20
  Installing     : cyrus-sasl-lib                                                                                                                                6/20
  Installing     : openldap                                                                                                                                      7/20
  Installing     : apr                                                                                                                                           8/20
  Installing     : perl-URI                                                                                                                                      9/20
  Installing     : postgresql-libs                                                                                                                              10/20
  Installing     : apr-util                                                                                                                                     11/20
  Installing     : neon                                                                                                                                         12/20
  Installing     : postgresql-libs                                                                                                                              13/20
  Installing     : ncurses                                                                                                                                      14/20
  Installing     : subversion                                                                                                                                   15/20
  Installing     : sqlite                                                                                                                                       16/20
  Installing     : apr-util                                                                                                                                     17/20
  Installing     : subversion                                                                                                                                   18/20
  Cleanup        : openldap                                                                                                                                     19/20
  Cleanup        : cyrus-sasl-lib                                                                                                                               20/20

Installed:
  subversion.i386 0:1.6.11-10.el5_8                                                subversion.x86_64 0:1.6.11-10.el5_8

Dependency Installed:
  apr.i386 0:1.2.7-11.el5_6.5                  apr.x86_64 0:1.2.7-11.el5_6.5          apr-util.i386 0:1.2.7-11.el5_5.2      apr-util.x86_64 0:1.2.7-11.el5_5.2
  cyrus-sasl-lib.i386 0:2.1.22-7.el5_8.1       db4.i386 0:4.3.29-10.el5_5.2           ncurses.i386 0:5.5-24.20060715        neon.i386 0:0.25.5-10.el5_4.1
  neon.x86_64 0:0.25.5-10.el5_4.1              openldap.i386 0:2.3.43-25.el5_8.1      perl-URI.noarch 0:1.35-3              postgresql-libs.i386 0:8.1.23-6.el5_8
  postgresql-libs.x86_64 0:8.1.23-6.el5_8      sqlite.i386 0:3.3.6-5

Dependency Updated:
  cyrus-sasl-lib.x86_64 0:2.1.22-7.el5_8.1                                             openldap.x86_64 0:2.3.43-25.el5_8.1

Complete!

起動オプションとしてリポジトリの場所を指定するためにコンフィグファイルを新しく作成し、サービス登録して起動させます。

# vi /etc/sysconfig/svnserve
OPTIONS="--root=/var/storage/00/main/svn/repos"

# chkconfig svnserve on
# service svnserve start

windowsのSVNクライアントから中身を覗いてみると正常に確認ができたのでOK。

svnのバックアップバッチも登録しておきます。
メモ: svnのバックアップ
ログファイル出力先ディレクトリと、ログファイル名にプリフィクスをつけてます。(svndumpall)

#!/bin/bash

REPOS_DIR=/var/storage/00/main/svn/repos/
BACKUP_DIR='/var/storage/00/main/data/03_バックアップ/svn/'

# log directory
log_dir="/var/storage/00/main/scripts/log"
if [ ! -d $log_dir ]
then
mkdir $log_dir
fi

# log file path
log_file=$log_dir"/svndumpall_"`date +%Y%m%d%H%M`".log"

# start
echo "### Start svn dump all ##########" >> $log_file
date >> $log_file

cd $BACKUP_DIR

# list repos
REPOS=`ls $REPOS_DIR`

echo "### target repos $REPOS" >> $log_file

for repo_name in $REPOS;
do
dump_file=$repo_name.`date +"%Y%m%d%H%M"`.svn.dump
svnadmin dump $REPOS_DIR$repo_name > $dump_file
tar zcvf $dump_file.tar.gz $dump_file >> $log_file
rm -f $dump_file >> $log_file
done

# end
echo "### End svn dump all ############" >> $log_file
date >> $log_file

exit 0

作成して実行してみます。

# vi /var/storage/00/main/scripts/svndumpall.sh
# chmod 755 /var/storage/00/main/scripts/svndumpall.sh
# /var/storage/00/main/scripts/svndumpall.sh
* リビジョン 0 をダンプしました。
* リビジョン 1 をダンプしました。
* リビジョン 2 をダンプしました。
* リビジョン 3 をダンプしました。
* リビジョン 0 をダンプしました。
* リビジョン 1 をダンプしました。
* リビジョン 2 をダンプしました。
* リビジョン 3 をダンプしました。
* リビジョン 4 をダンプしました。
* リビジョン 5 をダンプしました。
* リビジョン 6 をダンプしました。
* リビジョン 7 をダンプしました。
* リビジョン 8 をダンプしました。
* リビジョン 9 をダンプしました。
* リビジョン 10 をダンプしました。
* リビジョン 11 をダンプしました。
* リビジョン 12 をダンプしました。
* リビジョン 13 をダンプしました。
* リビジョン 14 をダンプしました。
* リビジョン 15 をダンプしました。
* リビジョン 16 をダンプしました。
* リビジョン 17 をダンプしました。
* リビジョン 18 をダンプしました。
* リビジョン 0 をダンプしました。
* リビジョン 1 をダンプしました。
* リビジョン 2 をダンプしました。
* リビジョン 3 をダンプしました。
* リビジョン 4 をダンプしました。
* リビジョン 5 をダンプしました。
* リビジョン 6 をダンプしました。
* リビジョン 7 をダンプしました。
* リビジョン 8 をダンプしました。
* リビジョン 9 をダンプしました。
* リビジョン 10 をダンプしました。
* リビジョン 11 をダンプしました。
* リビジョン 12 をダンプしました。
* リビジョン 13 をダンプしました。
* リビジョン 14 をダンプしました。
* リビジョン 15 をダンプしました。
* リビジョン 16 をダンプしました。
* リビジョン 17 をダンプしました。

出力先にもできてました。
そして同期スクリプトと同様にcron登録です。

# crontab -e
0 12 * * 2 /var/storage/00/main/scripts/svndumpall.sh

これで全て完了!!!
今の状態でシステム領域をバックアップしておきます。

DDforWindows - Silicon Linux Wiki

電源をOFFってUSBメモリの中身をまるごと保存します。
これでOSがクラッシュしてもあっという間に元通り!!!
すばらしい。

ではおしまい。

コメント