バックアップツールのamandaを使ってみた

※実際には、8/18のネタです。

■参考URL

http://www.howtoforge.com/disk-backup-with-amanda-on-debian-lenny

■メインのサーバ、クライアントをインストール。

$ echo "amanda-server amanda-client" | \
for list in `xargs`;do sudo apt-get install -y "$list";done

■関連パッケージをインストール

$ echo "xinetd gawk gnuplot readline-common" | \
for list in `xargs`;do sudo apt-get install -y "$list";done

■テープをCD-RWデバイスに置き換えるパッケージをオプションで。
 (これは後に削除しています)

$ echo "cdrw-taper" | \
for list in `xargs`;do sudo apt-get install -y "$list";done

■/etc/inetd.conf の設定確認。

$ sudo grep -v "^\#\|^\$" /etc/inetd.conf
amandaidx stream tcp nowait backup /usr/sbin/tcpd /usr/lib/amanda/amindexd amindexd -auth=bsd amdump amindexd amidxtaped
amidxtape stream tcp nowait backup /usr/sbin/tcpd /usr/lib/amanda/amidxtaped amidxtaped -auth=bsd amdump amindexd amidxtaped
amanda dgram udp wait backup /usr/sbin/tcpd /usr/lib/amanda/amandad -auth=bsd amdump amindexd amidxtaped

■編集内容のマニュアルを確認

$ man amanda.conf | grep "bsdtcp,\|bsd,"
will be used (bsd, bsdudp)
that will be used (bsd, bsdudp)
bsd, bsd authorization with udp initial connection and one tcp
bsdtcp, bsd authorization but use only one tcp connection.
bsdudp, like bsd, but will use only one tcp connection for all data

■オリジナルファイルの保存

$ echo "/etc/xinetd.d/amanda /etc/xinetd.d/amidxtape /etc/xinetd.d/amandaidx" | \
for list in `xargs`;do sudo cp -pi "$list" "${list}.org";done

■backup ユーザのパスワード設定

$ sudo passwd backup

■/etc/xinetd.d/amanda の設定編集

★編集前

$ cat /etc/xinetd.d/amanda| grep -v "^#"
service amanda
{
socket_type = dgram
protocol = udp
wait = yes
user = backup
group = backup
groups = yes
server = /usr/lib/amanda/amandad
server_args = -auth=bsd amdump amindexd amidxtaped
disable = no
}

★編集後

$ cat /etc/xinetd.d/amanda| grep -v "^#"
service amanda
{
socket_type = stream
protocol = tcp
wait = no
user = backup
group = backup
groups = yes
server = /usr/lib/amanda/amandad
server_args = -auth=bsdtcp amdump amindexd amidxtaped
disable = no
}

■/etc/xinetd.d/amidxtape の編集

★編集前

$ cat /etc/xinetd.d/amidxtape | grep -v "^#"
service amidxtape
{
socket_type = stream
protocol = tcp
wait = no
user = backup
group = backup
groups = yes
server = /usr/lib/amanda/amidxtaped
server_args = -auth=bsdtcp amdump amindexd amidxtaped
disable = no
}

★編集後

$ cat /etc/xinetd.d/amidxtape | grep -v "^#"
service amidxtape
{
socket_type = stream
protocol = tcp
wait = no
user = backup
group = backup
groups = yes
server = /usr/lib/amanda/amidxtaped
server_args = -auth=bsdtcp amdump amindexd amidxtaped
disable = no
}

■/etc/xinetd.d/amandaidx の編集

★編集前

$ cat /etc/xinetd.d/amandaidx | grep -v "^#"
service amandaidx
{
socket_type = stream
protocol = tcp
wait = no
user = backup
group = backup
groups = yes
server = /usr/lib/amanda/amindexd
server_args = -auth=bsd amdump amindexd amidxtaped
disable = no
}

編集後

service amandaidx
{
socket_type = stream
protocol = tcp
wait = no
user = backup
group = backup
groups = yes
server = /usr/lib/amanda/amindexd
server_args = -auth=bsdtcp amdump amindexd amidxtaped
disable = no
}

■xinetdサービスの再起動

$ sudo /etc/init.d/xinetd restart

■xinetdサービスの起動確認

$ sudo grep xinetd /var/log/syslog | grep started
Aug 18 00:30:04 hostname xinetd[29329]: xinetd Version 2.3.14 started with libwrap loadavg options compiled in.
Aug 18 00:55:39 hostname xinetd[29915]: xinetd Version 2.3.14 started with libwrap loadavg options compiled in.

■必要なディレクトリ、ファイルを作成します。

$ su backup -c "mkdir /etc/amanda/DailySet1"
$ su backup -c "mkdir /etc/amanda/DailySet1/logs"
$ sudo touch /etc/amanda/DailySet1/tapelist
$ su backup -c "mkdir /etc/amanda/DailySet1/curinfo"

■/etc/amanda/DailySet1/amanda.conf を以下のように設定します。

$ su backup -c "vim /etc/amanda/DailySet1/amanda.conf"

$ sudo cat /etc/amanda/DailySet1/amanda.conf
org "DailySet1" # your organization name for reports
mailto "backup_admin@mydomain.com" # space separated list of operators at your site
dumpuser "backup" # the user to run dumps under

logdir "/etc/amanda/DailySet1/logs" # log directory
infofile "/etc/amanda/DailySet1/curinfo" # database filename
indexdir "/etc/amanda/DailySet1/index" # index directory
tapelist "/etc/amanda/DailySet1/tapelist" # list of used tapes

tapecycle 9 tapes
tapetype DISK
tpchanger "chg-disk"
changerfile "/etc/amanda/DailySet1/changer" # needed by amlabel
tapedev "file:/space/vtapes/DailySet1/slots"

define tapetype DISK {
comment "Backup to HD"
length 5 gbytes
}

# comment holding disk section if needed
holdingdisk hd1 {
directory "/dumps/"
}

# to be used by any other dumptype
define dumptype global {
comment "Global definitions"
index yes
record yes
auth "bsdtcp"
}

define dumptype daily {
global
comment "daily dumptype"
compress client fast
program "GNUTAR"
strategy standard
priority high
exclude list "/etc/amanda/DailySet1/global-debian-exclude.list"
}

■キャッシュを利用しない場合はコメントアウトします。

$ sudo grep -B 1 -A 2 "holdingdisk" /etc/amanda/DailySet1/amanda.conf
# comment holding disk section if needed
holdingdisk hd1 {
directory "/dumps/"
}

■キャッシュ用のディレクトリの設定をします。

$ sudo test -d /dumps || sudo mkdir /dumps; \
sudo chmod 750 /dumps; \
sudo chown backup:backup /dumps

■ディスクラベルを確認します。

$ sudo cat /etc/fstab | grep LABEL

★パーティーションを区切って設定する場合は以下のようになるはず。参考URLからのコピペです。

$ sudo cat /etc/fstab | grep LABEL
LABEL=holdingdisk /dumps ext3 defaults 0 
LABEL=backup /space xfs _netdev 0 0 

■仮想テープの設定をします。

$ sudo mkdir -p /space/
$ sudo mkdir -p /space/vtapes/DailySet1/slots
$ sudo chown backup:backup -R /space/
$ sudo chmod 750 /space/vtapes
$ su - backup
パスワード:
$ cd /space/vtapes/DailySet1/slots
$ for i in `seq 1 9`; do mkdir slot$i;done
$ ln -s slot1 data
$ ammt -f file:/space/vtapes/DailySet1/slots status
file:/space/vtapes/DailySet1/slots status: ONLINE
$ for i in `seq 1 9`; do amlabel DailySet1 DailySet1-0$i slot $i; done1025までを追加したい場合

$ for i in `seq 10 25`; do mkdir slot$i;done
$ for i in `seq 10 25`; do amlabel DailySet1 DailySet1-0$i slot $i; done

■仮想テープをリセットして、最初のスロットをロードします。

$ amtape DailySet1 reset
amtape: changer is reset, slot 1 is loaded.

■dataがslot1にリンクしていることを確認して、backupユーザシェルから抜けます。

$ ls -l data
lrwxrwxrwx 1 backup backup 35 2011-08-18 01:25 data -> /space/vtapes/DailySet1/slots/slot1
$ exit

■バックアップ対象のディレクトリを確認します。

$ mount | grep ext3 | awk '{print $3}' | column
/ /boot /home /var /www/mydomain

■ドキュメントを参考に/etc/amanda/DailySet1/disklist を編集します。

$ ls /usr/share/doc/amanda-server/examples/disklist | xargs head -10
# sample Amanda2 disklist file, derived from CS.UMD.EDU's disklist
#
# If your configuration is called, say, "DailySet1", then this file
# normally goes in /etc/amanda/DailySet1/disklist.
#
# File format is:
#
# hostname diskdev dumptype
#
# where the dumptypes are defined by you in amanda.conf.

$ cat /etc/amanda/DailySet1/disklist
localhost /home comp-user-tar

■/etc/amandahosts で認証の設定を行います。

★編集前

$ sudo cat /etc/amandahosts
localhost backup

★編集後

$ sudo cat /etc/amandahosts
localhost root amindexd amidxtaped
localhost backup amdump
localhost root amindexd amidxtaped

■amandahostsのアクセス権の設定

$ ls -l /var/backups/.amandahosts
lrwxrwxrwx 1 root root 16 2011-08-18 00:16 /var/backups/.amandahosts -> /etc/amandahosts

$ ls -l /etc/amandahosts
-rw------- 1 backup backup 94 2011-08-18 01:40 /etc/amandahosts

★上記設定が異なる場合は以下を実行する

$ sudo ln -s /var/backups/.amandahosts /etc/amandahosts; \
sudo chmod 400 etc/amandahosts

■クライアントの設定

$ sudo cat /etc/amanda/amanda-client.conf
conf "DailySet1" # your config name
index_server "bckserver.mydomain.com" # your amindexd server
tape_server "bckserver.mdomain.com" # your amidxtaped server

auth "bsdtcp"

⇒参考URLからのコピペ。後に以下に修正。

$ sudo cat /etc/amanda/amanda-client.conf
conf "DailySet1" # your config name
index_server "localhost" # your amindexd server
tape_server "localhost" # your amidxtaped server


$ sudo cat /etc/amanda/amandahosts
localhost backup amdump


■クライアント用のアクセス権の確認

$ ls -la /var/backups/.amandahosts
lrwxrwxrwx 1 root root 16 2011-08-18 00:16 /var/backups/.amandahosts -> /etc/amandahosts

$ sudo ls -l /etc/amanda/amandahosts
-rw------- 1 backup backup 24 2011-08-18 01:49 /etc/amanda/amandahosts

★アクセス権が正しくない場合は以下を実行

$ sudo chown backup:backup /etc/amanda/amandahosts; \
sudo chmod 600 /etc/amanda/amandahosts

■クライアントチェック

$ su backup
パスワード:

★「0 problems」である事を確認します。

$ /usr/sbin/amcheck DailySet1 -cl localhost | grep problems --color
Client check: 1 host checked in 0.051 seconds, 0 problems found

$ /usr/sbin/amcheck DailySet1 -cl localhost
Amanda Tape Server Host Check
-----------------------------
Holding disk /dumps/: 42782036 kB disk space available, using 42782036 kB
NOTE: skipping tape checks
NOTE: host info dir /etc/amanda/DailySet1/curinfo/localhost does not exist
NOTE: it will be created on the next run.
NOTE: index dir /etc/amanda/DailySet1/index/localhost does not exist
NOTE: it will be created on the next run.
Server check took 0.001 seconds

Amanda Backup Client Hosts Check
--------------------------------
WARNING: Usage of fully qualified hostname recommended for Client localhost.
WARNING: Usage of fully qualified hostname recommended for Client localhost.
WARNING: Usage of fully qualified hostname recommended for Client localhost.
Client check: 1 host checked in 0.053 seconds, 0 problems found

(brought to you by Amanda 2.5.2p1)
$ /usr/sbin/amadmin DailySet1 disklist localhost
line 1:
host localhost:
interface default
disk /home:
program "GNUTAR"
exclude list "/etc/amanda/DailySet1/global-debian-exclude.list"
priority 2
dumpcycle 10
maxdumps 1
maxpromoteday 10000
bumpsize 10240
bumpdays 2
bumpmult 1.500000
strategy STANDARD
ignore NO
estimate CLIENT
compress CLIENT FAST
comprate 0.50 0.50
encrypt NONE
auth bsdtcp
kencrypt NO
amandad_path X
client_username X
ssh_keys X
holdingdisk AUTO
record YES
index YES
starttime 0000
fallback_splitsize 10Mb
skip-incr NO
skip-full NO
spindle -1

■テストします。

$ /usr/sbin/amdump DailySet1

★強制的にフルバックアップを行う場合

$ /usr/sbin/amadmin DailySet1 force


■MAILER-DAEMONとしてバックアップ結果のメールが届きました。

★/home分のディスクスペースが無い。
★/etc/fstab or /etc/mtabが見つからない。
★SCSI driverが開けない(cdrw-taperが原因と思われる)

Hostname: hostname
Org : DailySet1
Config : DailySet1
Date : August 18, 2011

These dumps were to tape DailySet1-01.
The next tape Amanda expects to use is: a new tape.
The next new tape already labelled is: DailySet1-02.

FAILURE AND STRANGE DUMP SUMMARY:
localhost /home lev 0 FAILED [dump larger than available tape space, 54170335 KB, but cannot incremental dump new disk]
taper: ERROR could not mount disk: mount: can't find file in /etc/fstab or /etc/mtab
taper: ERROR Can't read media info, using defaults: dvd+rw-mediainfo returned 'file: unable to open: No such file or directory_', cdrecord -atip returned '/usr/bin/wodim: Is a directory. _Cannot open SCSI driver!_For possible targets try 'wodim --devices' or 'wodim -scanbus'._For possible transport specifiers try 'wodim dev=help'._For IDE/ATAPI devices configuration, see the file README.ATAPI.setup from_the wodim documentation._'
planner: FATAL cannot fit anything on tape, bailing out


STATISTICS:
Total Full Incr.
-------- -------- --------
Estimate Time (hrs:min) 0:00
Run Time (hrs:min) 0:00
Dump Time (hrs:min) 0:00 0:00 0:00
Output Size (meg) 0.0 0.0 0.0
Original Size (meg) 0.0 0.0 0.0
Avg Compressed Size (%) -- -- --
Filesystems Dumped 0 0 0
Avg Dump Rate (k/s) -- -- --

Tape Time (hrs:min) 0:00 0:00 0:00
Tape Size (meg) 0.0 0.0 0.0
Tape Used (%) 0.0 0.0 0.0
Filesystems Taped 0 0 0

Chunks Taped 0 0 0
Avg Tp Write Rate (k/s) -- -- --

USAGE BY TAPE:
Label Time Size % Nb Nc
DailySet1-01 0:00 0k 0.0 0 0

^L
NOTES:
planner: tapecycle (9) <= runspercycle (10)
planner: Adding new disk localhost:/home.
planner: disk localhost:/home, full dump (54170335KB) will be larger than available tape space
driver: WARNING: got empty schedule from planner
taper: tape DailySet1-01 kb 0 fm 0 [OK]
^L
DUMP SUMMARY:
DUMPER STATS TAPER STATS
HOSTNAME DISK L ORIG-kB OUT-kB COMP% MMM:SS KB/s MMM:SS KB/s
-------------------------- ------------------------------------- -------------
localhost /home 0 FAILED --------------------------------------------

(brought to you by Amanda version 2.5.2p1)

■以下を実行してSCSIでは無いことを確認した為、cdrw-taperを削除。

$ wodim --devices
$ wodim -scanbus
$ dmesg | grep CD
[ 2.496117] hda: ATAPI DVD D DH16DYP, ATAPI CD/DVD-ROM drive
[ 3.195110] Uniform CD-ROM driver Revision: 3.20

$ sudo apt-get purge cdrw-taper

■再テストします。

$ /usr/sbin/amdump DailySet1

Hostname: hostname
Org : DailySet1
Config : DailySet1
Date : August 18, 2011

These dumps were to tape DailySet1-06.
The next tape Amanda expects to use is: a new tape.
The next new tape already labelled is: DailySet1-07.

FAILURE AND STRANGE DUMP SUMMARY:
localhost /home lev 0 FAILED [dump larger than available tape space, 545447
35 KB, but cannot incremental dump new disk]
planner: FATAL cannot fit anything on tape, bailing out


STATISTICS:
Total Full Incr.
-------- -------- --------
Estimate Time (hrs:min) 0:00
Run Time (hrs:min) 0:00
Dump Time (hrs:min) 0:00 0:00 0:00
Output Size (meg) 0.0 0.0 0.0
Original Size (meg) 0.0 0.0 0.0
Avg Compressed Size (%) -- -- --
Filesystems Dumped 0 0 0
Avg Dump Rate (k/s) -- -- --

Tape Time (hrs:min) 0:00 0:00 0:00
Tape Size (meg) 0.0 0.0 0.0
Tape Used (%) 0.0 0.0 0.0
Filesystems Taped 0 0 0

Chunks Taped 0 0 0
Avg Tp Write Rate (k/s) -- -- --

USAGE BY TAPE:
Label Time Size % Nb Nc
DailySet1-06 0:00 0k 0.0 0 0

^L
NOTES:
planner: tapecycle (9) <= runspercycle (10)
planner: Forcing full dump of localhost:/home as directed.
driver: WARNING: This is not the first amdump run today. Enable the usetimesta
mps option in the configuration file if you want to run amdump more than once pe
r calendar day.
planner: disk localhost:/home, full dump (54544735KB) will be larger than avai
lable tape space
driver: WARNING: got empty schedule from planner
taper: tape DailySet1-06 kb 0 fm 0 [OK]

^L
DUMP SUMMARY:
DUMPER STATS TAPER STATS
HOSTNAME DISK L ORIG-kB OUT-kB COMP% MMM:SS KB/s MMM:SS KB/s
-------------------------- ------------------------------------- -------------
localhost /home 0 FAILED --------------------------------------------

(brought to you by Amanda version 2.5.2p1)

■/homeよりも容量の小さい「/」デバイスを対象に変更します。

$ sudo cat /etc/amanda/DailySet1/disklist
localhost / daily


■除外リストを作成、アクセス権を設定します。

$ sudo cat /etc/amanda/DailySet1/global-debian-exclude.list
./dev

$ sudo chmod 644 /etc/amanda/DailySet1/global-debian-exclude.list

■再々テストです。

$ su backup 
$ /usr/sbin/amdump DailySet1

■成功したログが表示されています。

Hostname: hostname
Org : DailySet1
Config : DailySet1
Date : August 18, 2011

These dumps were to tape DailySet1-07.
The next tape Amanda expects to use is: a new tape.
The next new tape already labelled is: DailySet1-08.

FAILURE AND STRANGE DUMP SUMMARY:
localhost / lev 0 STRANGE


STATISTICS:
Total Full Incr.
-------- -------- --------
Estimate Time (hrs:min) 0:00
Run Time (hrs:min) 0:04
Dump Time (hrs:min) 0:03 0:03 0:00
Output Size (meg) 858.8 858.8 0.0
Original Size (meg) 2001.2 2001.2 0.0
Avg Compressed Size (%) 42.9 42.9 --
Filesystems Dumped 1 1 0
Avg Dump Rate (k/s) 4915.0 4915.0 --

Tape Time (hrs:min) 0:00 0:00 0:00
Tape Size (meg) 858.9 858.9 0.0
Tape Used (%) 16.8 16.8 0.0
Filesystems Taped 1 1 0

Chunks Taped 0 0 0
Avg Tp Write Rate (k/s) 48942.0 48942.0 --

USAGE BY TAPE:
Label Time Size % Nb Nc
DailySet1-07 0:00 879488k 16.8 1 0
^L
FAILED AND STRANGE DUMP DETAILS:

/-- localhost / lev 0 STRANGE
sendbackup: start [localhost:/ level 0]
sendbackup: info BACKUP=/bin/tar
sendbackup: info RECOVER_CMD=/bin/gzip -dc |/bin/tar -xpGf - ...
sendbackup: info COMPRESS_SUFFIX=.gz
sendbackup: info end
? gtar: ./dumps/20110818030307/localhost._.0.tmp: file changed as we read it
| gtar: ./tmp/mapping-username: socket ignored
| gtar: ./tmp/scim-panel-socket127.0.0.1\:1-gdm: socket ignored
| gtar: ./tmp/scim-panel-socket192.168.177.68\:15-username: socket ignored
| gtar: ./tmp/scim-panel-socket\:11-username: socket ignored
| gtar: ./tmp/scim-panel-socketlocalhost\:12-username: socket ignored
| gtar: ./tmp/.ICE-unix/16648: socket ignored
| gtar: ./tmp/.ICE-unix/16774: socket ignored
| gtar: ./tmp/.ICE-unix/24915: socket ignored
| gtar: ./tmp/.ICE-unix/25149: socket ignored
| gtar: ./tmp/.ICE-unix/25390: socket ignored
| gtar: ./tmp/.ICE-unix/26864: socket ignored
| gtar: ./tmp/.X11-unix/X1: socket ignored
| gtar: ./tmp/orbit-username/linc-3dde-0-6c2a6ff284852: socket ignored
| gtar: ./tmp/orbit-username/linc-3deb-0-5fe5e3578ed07: socket ignored
| gtar: ./tmp/orbit-username/linc-40a3-0-16303d9d54971: socket ignored
| gtar: ./tmp/orbit-username/linc-4108-0-25a2ed31588b3: socket ignored
| gtar: ./tmp/orbit-username/linc-413a-0-361c78e393320: socket ignored
| gtar: ./tmp/orbit-username/linc-413d-0-361c78e3a9d77: socket ignored
| gtar: ./tmp/orbit-username/linc-4146-0-3b289aacb496c: socket ignored
| gtar: ./tmp/orbit-username/linc-4167-0-410be8b364629: socket ignored
| gtar: ./tmp/orbit-username/linc-4186-0-17e5927433e16: socket ignored
| gtar: ./tmp/orbit-username/linc-41b8-0-43b7bc4f6e1f9: socket ignored
| gtar: ./tmp/orbit-username/linc-41b9-0-43b7bc4f77525: socket ignored
| gtar: ./tmp/orbit-username/linc-41c5-0-4e3c22f082351: socket ignored
| gtar: ./tmp/orbit-username/linc-41eb-0-1d05c2f4680d9: socket ignored
| gtar: ./tmp/orbit-username/linc-4265-0-28f9d11122a8: socket ignored
| gtar: ./tmp/orbit-username/linc-5a67-0-6cbdca532509f: socket ignored
| gtar: ./tmp/orbit-username/linc-5bb2-0-79a9a9673f881: socket ignored
| gtar: ./tmp/orbit-username/linc-61ab-0-72e99cbb8ab: socket ignored
| gtar: ./tmp/orbit-username/linc-623d-0-5ef3e44b5613c: socket ignored
| gtar: ./tmp/orbit-username/linc-627d-0-5537e2f166400: socket ignored
| gtar: ./tmp/orbit-username/linc-6287-0-4d69f7782e79: socket ignored
| gtar: ./tmp/orbit-username/linc-6295-0-35765ec8b6c2: socket ignored
| gtar: ./tmp/orbit-username/linc-632e-0-7363fb5092b87: socket ignored
| gtar: ./tmp/orbit-username/linc-636c-0-27b26e21a61bc: socket ignored
| gtar: ./tmp/orbit-username/linc-6376-0-301f12ef940b3: socket ignored
| gtar: ./tmp/orbit-username/linc-6379-0-3d8f2b5d87576: socket ignored
| gtar: ./tmp/orbit-username/linc-637c-0-3d8f2b5d92d5b: socket ignored
| gtar: ./tmp/orbit-username/linc-6384-0-5e56f1849beba: socket ignored
| gtar: ./tmp/orbit-username/linc-68f0-0-4eeaafcb845cb: socket ignored
| gtar: ./tmp/orbit-username/linc-6930-0-7a4f9b64983e7: socket ignored
| gtar: ./tmp/orbit-username/linc-693a-0-5d88cf15a92d3: socket ignored
| gtar: ./tmp/orbit-username/linc-693d-0-10543cda49fb: socket ignored
| gtar: ./tmp/orbit-username/linc-6940-0-10543cdac720: socket ignored
| gtar: ./tmp/orbit-username/linc-694b-0-645712e7bf4ae: socket ignored
| gtar: ./tmp/orbit-username/linc-6b0a-0-61486245798f9: socket ignored
| gtar: ./tmp/orbit-username/linc-6b0a-0-f076c00caf39: socket ignored
| gtar: ./tmp/orbit-root/linc-42d1-0-25145f2d5ecfd: socket ignored
| gtar: ./tmp/vmware-username/unity-helper-ipc-192.168.177.68\:17.0: socket ignored

| gtar: ./var/run/acpid.socket: socket ignored
| gtar: ./var/run/vmnat.26140: socket ignored
| gtar: ./var/run/apache2/cgisock.28810: socket ignored
| gtar: ./var/run/dbus/system_bus_socket: socket ignored
| gtar: ./var/run/vmware/usbarbitrator-socket: socket ignored
| Total bytes written: 2098370560 (2.0GiB, 12MiB/s)
sendbackup: size 2049190
sendbackup: end
\--------
sendbackup: end
\--------

^L
NOTES:
planner: tapecycle (9) <= runspercycle (10)
planner: Adding new disk localhost:/.
driver: WARNING: This is not the first amdump run today. Enable the usetimesta
mps option in the configuration file if you want to run amdump more than once pe
r calendar day.
taper: tape DailySet1-07 kb 879520 fm 1 [OK]
big estimate: localhost / 0
est: 1015136k out 879488k

^L
DUMP SUMMARY:
DUMPER STATS TAPER STATS
HOSTNAME DISK L ORIG-kB OUT-kB COMP% MMM:SS KB/s MMM:SS KB/s
-------------------------- ------------------------------------- -------------
localhost / 0 2049190 879488 42.9 2:59 4915.0 0:18 48940.0

(brought to you by Amanda version 2.5.2p1)


■ログを確認します。ローテーションされた数値の大きい方が最新です。

$ su backup
$ ls /etc/amanda/DailySet1/logs
amdump.1 amdump.4 amdump.7 log.20110818.2 log.20110818.5
amdump.2 amdump.5 log.20110818.0 log.20110818.3 log.20110818.6
amdump.3 amdump.6 log.20110818.1 log.20110818.4 oldlog

■テープ状態を再チェック

$ /usr/sbin/ammt -f file:/space/vtapes/DailySet1/slots status
file:/space/vtapes/DailySet1/slots status: ONLINE

■メールで「DailySet1-07」とある通り、slot7にバックアップが出来ています。

$ du -h /space/vtapes/DailySet1/slots/*
0 /space/vtapes/DailySet1/slots/data
4.0K /space/vtapes/DailySet1/slots/info
76K /space/vtapes/DailySet1/slots/slot1
76K /space/vtapes/DailySet1/slots/slot2
76K /space/vtapes/DailySet1/slots/slot3
76K /space/vtapes/DailySet1/slots/slot4
76K /space/vtapes/DailySet1/slots/slot5
76K /space/vtapes/DailySet1/slots/slot6
860M /space/vtapes/DailySet1/slots/slot7
76K /space/vtapes/DailySet1/slots/slot8
76K /space/vtapes/DailySet1/slots/slot9

$ du -h /space/vtapes/DailySet1/slots/slot7/0000*
4.0K /space/vtapes/DailySet1/slots/slot7/00000-DailySet1-07
32K /space/vtapes/DailySet1/slots/slot7/00000.DailySet1-07
4.0K /space/vtapes/DailySet1/slots/slot7/00001-localhost._.0
860M /space/vtapes/DailySet1/slots/slot7/00001.localhost._.0
4.0K /space/vtapes/DailySet1/slots/slot7/00002-TAPEEND
32K /space/vtapes/DailySet1/slots/slot7/00002.TAPEEND

■もう一度実行してみます。

★Incr(=incremental)、つまり増分バックアップが行われた事が分かります。

$ /usr/sbin/amdump DailySet1

Hostname: hostname
Org : DailySet1
Config : DailySet1
Date : August 18, 2011

These dumps were to tape DailySet1-08.
The next tape Amanda expects to use is: a new tape.
The next new tape already labelled is: DailySet1-09.

FAILURE AND STRANGE DUMP SUMMARY:
localhost / lev 1 STRANGE


STATISTICS:
Total Full Incr.
-------- -------- --------
Estimate Time (hrs:min) 0:00
Run Time (hrs:min) 0:02
Dump Time (hrs:min) 0:01 0:00 0:01
Output Size (meg) 854.1 0.0 854.1
Original Size (meg) 870.6 0.0 870.6
Avg Compressed Size (%) 98.1 -- 98.1 (level:#disks ...)
Filesystems Dumped 1 0 1 (1:1)
Avg Dump Rate (k/s) 11899.7 -- 11899.7

Tape Time (hrs:min) 0:00 0:00 0:00
Tape Size (meg) 854.1 0.0 854.1
Tape Used (%) 16.7 0.0 16.7 (level:#disks ...)
Filesystems Taped 1 0 1 (1:1)

Chunks Taped 0 0 0
Avg Tp Write Rate (k/s) 94414.3 -- 94414.3

USAGE BY TAPE:
Label Time Size % Nb Nc
DailySet1-08 0:00 874560k 16.7 1 0
^L
FAILED AND STRANGE DUMP DETAILS:

/-- localhost / lev 1 STRANGE
sendbackup: start [localhost:/ level 1]
sendbackup: info BACKUP=/bin/tar
sendbackup: info RECOVER_CMD=/bin/gzip -dc |/bin/tar -xpGf - ...
sendbackup: info COMPRESS_SUFFIX=.gz
sendbackup: info end
? gtar: ./dumps/20110818032252/localhost._.1.tmp: file changed as we read it
| Total bytes written: 912875520 (871MiB, 12MiB/s)
sendbackup: size 891480
sendbackup: end
\--------

^L
NOTES:
planner: tapecycle (9) <= runspercycle (10)
driver: WARNING: This is not the first amdump run today. Enable the usetimesta
mps option in the configuration file if you want to run amdump more than once pe
r calendar day.
taper: tape DailySet1-08 kb 874592 fm 1 [OK]
small estimate: localhost / 1
sendbackup: end
\--------

^L
NOTES:
planner: tapecycle (9) <= runspercycle (10)
driver: WARNING: This is not the first amdump run today. Enable the usetimesta
mps option in the configuration file if you want to run amdump more than once pe
r calendar day.
taper: tape DailySet1-08 kb 874592 fm 1 [OK]
small estimate: localhost / 1
est: 445536k out 874560k

^L
DUMP SUMMARY:
DUMPER STATS TAPER STATS
HOSTNAME DISK L ORIG-kB OUT-kB COMP% MMM:SS KB/s MMM:SS KB/s
-------------------------- ------------------------------------- -------------
localhost / 1 891480 874560 98.1 1:13 11899.6 0:09 94411.6


(brought to you by Amanda version 2.5.2p1)

■課題

・ディスクが一杯というエラーは、テープを5GBに設定しているのが原因?
・実際にバックアップしたい、/home/vmware以下をバックアップする方法は?
・/var/backups/mboxが無く、backupのメールアカウントも無い為、「Mailer-Daemon」として通知されている。メールサーバはデフォルトのexim4。回避方法は?

■まとめ

 とりあえずローカルで仮想テープにバックアップは出来る事を確認したので、
 後日、課題部分を調整したいと思う。