3.安装配置和测试的安装配置:
首先使用yum 安装一些工具软件:
yum install zlib-devel
yum install lsscsi
yum install mt-st
yum install mtx
yum install lzo
还有其他包,可能需要从网上下载:
lzo-devel-2.03-3.1.el6.x86_64
lzo-minilzo-2.03-3.1.el6.x86_64
安装完毕后,从MHVTL网站下载所需的包:
mhvtl-2012-08-08.tgz
首先添加VTL用户:
#useradd vtl
#passwd vtl
#mkdir /opt/mhvtl (这个目录是存放虚拟磁带的海量存储空间)
#chown –Rf vtl:vtl /opt/mhvtl
创建mhvtl的配置目录:
mkdir /etc/mhvtl
chown -Rf vtl:vtl /etc/mhvtl(这个目录是存放mhvtl的存储空间)
MHVTL INSTALL:
# tar xvf mhvtl-2012-08-08.tgz
#cd mhvtl-1.4/
# make distclean
首先安装kernel部分:
# cd kernel/
# make distclean
#make
# make install
然后其他部分:
# cd ..
#make
#make install
安装完成后,/etc/init.d/mhvtl start即可启动mhvtl, 如果没有配置文件,会自动生成缺省的配置文件。
停止mhvtl:
#/etc/init.d/mhvtl stop
停止mhvtl后,为了便于其他的备份软件使用,编辑修改mhvtl配置文件,主要包括device.conf,mhvtl.conf, library_contents.xx ,如下:
[root@mhvtlserver mhvtl]# more /etc/mhvtl/device.conf
VERSION: 5
# VPD page format:
# ... # NAA format is an 8 hex byte value seperated by ':'
# Note: NAA is part of inquiry VPD 0x83
#
# Each 'record' is separated by one (or more) blank lines.
# Each 'record' starts at column 1
# Serial num max len is 10.
# Compression: factor X enabled 0|1
# Where X is zlib compression factor 1 = Fastest compression
# 9 = Best compression
# enabled 0 == off, 1 == on
#
# fifo: /var/tmp/mhvtl
# If enabled, data must be read from fifo, otherwise daemon will block
# trying to write.
# e.g. cat /var/tmp/mhvtl (in another terminal)
Library: 10 CHANNEL: 00 TARGET: 00 LUN: 00 (定义带库,这一行中的10是带库的标识,带库的配置则在相应的library_contents.10文件中指定)
Vendor identification: IBM
Product identification: 03584L32
Product revision level: 4.02
Unit serial number: 9890400
NAA: 50:22:33:44:ab:00:00:00
Home directory: /opt/mhvtl
# fifo: /var/tmp/mhvtl
Drive: 11 CHANNEL: 00 TARGET: 01 LUN: 00 (以下定义各个驱动器)
Library ID: 10 Slot: 01
Vendor identification: IBM
Product identification: ULTRIUM-TD3
Product revision level: 51TB
Unit serial number: 9825111
NAA: 10:22:33:44:ab:00:01:00
Compression: factor 1 enabled 1
Compression type: lzo
Backoff: 1000
# fifo: /var/tmp/mhvtl
Drive: 12 CHANNEL: 00 TARGET: 02 LUN: 00
Library ID: 10 Slot: 02
Vendor identification: IBM
Product identification: ULTRIUM-TD3
Unit serial number: 9825112
Product revision level: 51TB
NAA: 10:22:33:44:ab:00:02:00
Compression: factor 1 enabled 1
Compression type: lzo
Backoff: 1000
# fifo: /var/tmp/mhvtl
Drive: 13 CHANNEL: 00 TARGET: 03 LUN: 00
Library ID: 10 Slot: 03
Vendor identification: IBM
Product identification: ULTRIUM-TD3
Unit serial number: 9825113
Product revision level: 51TB
NAA: 10:22:33:44:ab:00:03:00
Compression: factor 1 enabled 1
Compression type: lzo
Backoff: 1000
# fifo: /var/tmp/mhvtl
Drive: 14 CHANNEL: 00 TARGET: 04 LUN: 00
Library ID: 10 Slot: 04
Vendor identification: IBM
Product identification: ULTRIUM-TD3
Unit serial number: 9825114
Product revision level: 51TB
NAA: 10:22:33:44:ab:00:04:00
Compression: factor 1 enabled 1
Compression type: lzo
Backoff: 1000
# fifo: /var/tmp/mhvtl
Library_contents.10中指定磁带,驱动器等的数量,这里磁带类型用L3---因为驱动器是ULTRIUM-TD3:
[root@mhvtlserver mhvtl]# more library_contents.10
Drive 1:
Drive 2:
Drive 3:
Drive 4:
Picker 1:
MAP 1:
MAP 2:
MAP 3:
MAP 4:
# Slot 1 - ?, no gaps
# Slot N: [barcode]
# [barcode]
# a barcode is comprised of three fields: [Leading] [identifier] [Trailing]
# Leading "CLN" -- cleaning tape
# Leading "W" -- WORM tape
# Leading "NOBAR" -- will appear to have no barcode
# If the barcode is at least 8 character long, then the last two characters are Trailing
# Trailing "S3" - SDLT600
# Trailing "X4" - AIT-4
# Trailing "L1" - LTO 1, "L2" - LTO 2, "L3" - LTO 3, "L4" - LTO 4, "L5" - LTO 5
# Training "LT" - LTO 3 WORM, "LU" LTO 4 WORM, "LV" LTO 5 WORM
# Trailing "TA" - T10000+
# Trailing "JA" - 3592+
# Trailing "JB" - 3592E05+
# Trailing "JW" - WORM 3592+
# Trailing "JX" - WORM 3592E05+
#
Slot 1: E01001L3
Slot 2: E01002L3
Slot 3: E01003L3
Slot 4: E01004L3
Slot 5: E01005L3
Slot 6: E01006L3
Slot 7: E01007L3
Slot 8: E01008L3
Slot 9: E01009L3
Slot 10: E01010L3
Slot 11: E01011L3
Slot 12: E01012L3
Slot 13: E01013L3
Slot 14: E01014L3
Slot 15: E01015L3
Slot 16: E01016L3
Slot 17: E01017L3
Slot 18: E01018L3
Slot 19: E01019L3
Slot 20: E01020L3
Slot 21:
Slot 22:
Slot 23:
Slot 24:
Slot 25:
Slot 26:
Slot 27:
Slot 28:
Slot 29:
Slot 30: E01030L3
Slot 31: E01031L3
Slot 32: E01032L3
Slot 33: E01033L3
Slot 34: E01034L3
Slot 35: E01035L3
Slot 36: E01036L3
Slot 37: E01037L3
Slot 38: E01038L3
Slot 39: E01039L3
mhvtl.conf配置文件:
[root@mhvtlserver mhvtl]# more /etc/mhvtl/mhvtl.conf
# Home directory for config file(s)
MHVTL_CONFIG_PATH=/etc/mhvtl
# Default media capacity (500 M)
CAPACITY=400000 (每盘磁带400G)
# Set default verbosity [0|1|2|3]
VERBOSE=1
# Set kernel module debuging [0|1]
VTL_DEBUG=0
修改完毕mhvtl的配置文件后,启动mhvtl:
#/etc/init.d/mhvtl start
将其添加到chkconfig中:
#chkconfig --add mhvtl
#chkconfig mhvtl {on|off} (设置自动启动,这里设置为off,然后在/etc/rc.local中启动)
查看生成的mhvtl设备:
#lsscsi -g
…
[6:0:0:0] mediumx IBM 03584L32 4.02 - /dev/sg21
[6:0:1:0] tape IBM ULTRIUM-TD3 51TB - /dev/sg17
[6:0:2:0] tape IBM ULTRIUM-TD3 51TB - /dev/sg18
[6:0:3:0] tape IBM ULTRIUM-TD3 51TB - /dev/sg19
[6:0:4:0] tape IBM ULTRIUM-TD3 51TB - /dev/sg20 B.设备测试:
[root@mhvtlserver mhvtl]# mtx -f /dev/sg21 status (/dev/sg21为03584L32 mediumx)
Storage Changer /dev/sg21:4 Drives, 43 Slots ( 4 Import/Export )
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
Storage Element 1:Full :VolumeTag=E01001L3
Storage Element 2:Full :VolumeTag=E01002L3
Storage Element 3:Full :VolumeTag=E01003L3
Storage Element 4:Full :VolumeTag=E01004L3
Storage Element 5:Full :VolumeTag=E01005L3
Storage Element 6:Full :VolumeTag=E01006L3
Storage Element 7:Full :VolumeTag=E01007L3
Storage Element 8:Full :VolumeTag=E01008L3
Storage Element 9:Full :VolumeTag=E01009L3
Storage Element 10:Full :VolumeTag=E01010L3
Storage Element 11:Full :VolumeTag=E01011L3
Storage Element 12:Full :VolumeTag=E01012L3
Storage Element 13:Full :VolumeTag=E01013L3
Storage Element 14:Full :VolumeTag=E01014L3
Storage Element 15:Full :VolumeTag=E01015L3
Storage Element 16:Full :VolumeTag=E01016L3
Storage Element 17:Full :VolumeTag=E01017L3
Storage Element 18:Full :VolumeTag=E01018L3
Storage Element 19:Full :VolumeTag=E01019L3
Storage Element 20:Full :VolumeTag=E01020L3
Storage Element 21:Empty
Storage Element 22:Empty
Storage Element 23:Empty
Storage Element 24:Empty
Storage Element 25:Empty
Storage Element 26:Empty
Storage Element 27:Empty
Storage Element 28:Empty
Storage Element 29:Empty
Storage Element 30:Full :VolumeTag=E01030L3
Storage Element 31:Full :VolumeTag=E01031L3
Storage Element 32:Full :VolumeTag=E01032L3
Storage Element 33:Full :VolumeTag=E01033L3
Storage Element 34:Full :VolumeTag=E01034L3
Storage Element 35:Full :VolumeTag=E01035L3
Storage Element 36:Full :VolumeTag=E01036L3
Storage Element 37:Full :VolumeTag=E01037L3
Storage Element 38:Full :VolumeTag=E01038L3
Storage Element 39:Full :VolumeTag=E01039L3
Storage Element 40 IMPORT/EXPORT:Empty
Storage Element 41 IMPORT/EXPORT:Empty
Storage Element 42 IMPORT/EXPORT:Empty
Storage Element 43 IMPORT/EXPORT:Empty
将磁带从1号槽位装入driver 0:
[root@mhvtlserver mhvtl]# mtx -f /dev/sg21 load 1 0
Loading media from Storage Element 1 into drive 0...done
[root@mhvtlserver mhvtl]# mtx -f /dev/sg21 status
Storage Changer /dev/sg21:4 Drives, 43 Slots ( 4 Import/Export )
Data Transfer Element 0:Full (Storage Element 1 Loaded):VolumeTag = E01001L3
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
Storage Element 1:Empty
Storage Element 2:Full :VolumeTag=E01002L3
…
将磁带从drive0卸到1号槽位:
[root@mhvtlserver mhvtl]# mtx -f /dev/sg21 unload 1 0
Unloading drive 0 into Storage Element 1...done
[root@mhvtlserver mhvtl]# mtx -f /dev/sg21 status
Storage Changer /dev/sg21:4 Drives, 43 Slots ( 4 Import/Export )
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
Storage Element 1:Full :VolumeTag=E01001L3
…
读写测试:
载入39号槽位的磁带到drive 0 (/dev/IBMtape0)并读写:
[root@mhvtlserver mhvtl]# mtx -f /dev/sg21 load 39 0
Loading media from Storage Element 39 into drive 0...done
[root@mhvtlserver mhvtl]# cd /opt/mhvtl/E01039L3/
[root@mhvtlserver E01039L3]# ls -l
total 4
-rw-rw---- 1 vtl vtl 0 Aug 14 15:43 data
-rw-rw---- 1 vtl vtl 0 Aug 14 15:43 indx
-rw-rw---- 1 vtl vtl 1536 Aug 29 17:55 meta
查看
[root@mhvtlserver E01039L3]# mt -f /dev/IBMtape0 status
SCSI 2 tape drive:
File number=-1, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x44 (LTO-3).
Soft error count since last status=0
General status bits on (41000000):
BOT ONLINE
查看没有磁带的驱动器:
[root@mhvtlserver E01039L3]# mt -f /dev/IBMtape1 status
SCSI 2 tape drive:
File number=-1, block number=-1, partition=0.
Tape block size 0 bytes. Density code 0x44 (LTO-3).
Soft error count since last status=0
General status bits on (40000):
DR_OPEN
写入磁带:
[root@mhvtlserver E01039L3]# tar cvvf /dev/IBMtape0 /tmp/software/RHEL6.1X86_64.iso
tar: Removing leading `/' from member names
-rw-r--r-- root/root 3600842752 2012-08-16 16:33 /tmp/software/RHEL6.1X86_64.iso
[root@mhvtlserver E01039L3]# ls -l
total 3617140
-rw-rw---- 1 vtl vtl 3520277200 Aug 29 18:20 data
-rw-rw---- 1 vtl vtl 180043264 Aug 29 18:20 indx
-rw-rw---- 1 vtl vtl 1544 Aug 29 18:20 meta
读:(列出磁带内容)
[root@mhvtlserver E01039L3]# mt -f /dev/IBMtape0 rewind
[root@mhvtlserver E01039L3]# tar tvf /dev/IBMtape0
-rw-r--r-- root/root 3600842752 2012-08-16 16:33 tmp/software/RHEL6.1X86_64.iso
擦掉磁带内容再查看:
[root@mhvtlserver E01039L3]# mt -f /dev/IBMtape0 erase
[root@mhvtlserver E01039L3]# tar tvf /dev/IBMtape0
tar: /dev/IBMtape0: Cannot read: Input/output error
tar: At beginning of tape, quitting now
tar: Error is not recoverable: exiting now
[root@mhvtlserver E01039L3]# ls -l
total 4
-rw-rw---- 1 vtl vtl 0 Aug 29 18:23 data
-rw-rw---- 1 vtl vtl 0 Aug 29 18:23 indx
-rw-rw---- 1 vtl vtl 1536 Aug 29 18:23 meta
[root@mhvtlserver E01039L3]# mt -f /dev/IBMtape0 rewind
[root@mhvtlserver E01039L3]# mt -f /dev/IBMtape0 status
SCSI 2 tape drive:
File number=-1, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x44 (LTO-3).
Soft error count since last status=0
General status bits on (41000000):
BOT ONLINE
将该磁带放回39号槽位:
[root@mhvtlserver E01039L3]# mtx -f /dev/sg21 unload 39 0
Unloading drive 0 into Storage Element 39...done
[root@mhvtlserver E01039L3]# mtx -f /dev/sg21 status
Storage Changer /dev/sg21:4 Drives, 43 Slots ( 4 Import/Export )
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
…
Storage Element 39:Full :VolumeTag=E01039L3
…