【虚拟带库】mhvtl虚拟带库安装与配置

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:1060

【虚拟带库】mhvtl虚拟带库安装与配置

1、配置存储磁盘至linux as 5上面
[root@linux02 vtl]# lspci
13:01.0 Fibre Channel: Emulex Corporation LP9000 Fibre Channel Host Adapter (rev 01)
[root@linux02 vtl]# cat /sys/class/fc_host/host1/fabric_name
0x100000051e020e38
[root@linux02 vtl]# fdisk -l
Disk /dev/cciss/c0d0: 72.8 GB, 72833679360 bytes
255 heads, 32 sectors/track, 17433 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 5140 20971184 7 HPFS/NTFS
/dev/cciss/c0d0p2 5141 17433 50155440 f W95 Ext'd (LBA)
/dev/cciss/c0d0p5 5141 10281 20975264 7 HPFS/NTFS
/dev/cciss/c0d0p6 10282 16662 26034464 83 Linux
/dev/cciss/c0d0p7 16663 17433 3145664 82 Linux swap / Solaris
Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sda doesn't contain a valid partition table
[root@linux02 vtl]#
[root@linux02 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 32635.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-32635, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-32635, default 32635): +180g
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@linux02 ~]# mkfs.ext3 /dev/sda1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
21987328 inodes, 43947807 blocks
2197390 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1342 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@linux02 ~]# mount -t ext3 /dev/sda1 /opt/mhvtl
[root@linux02 opt]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p6 25G 2.9G 20G 13% /
tmpfs 948M 0 948M 0% /dev/shm
/dev/sda1 166G 188M 157G 1% /opt/mhvtl
modify /etc/fstab

2、安装kernel-devel包

[root@linux02 vtl]# uname -a
Linux linux02 2.6.18-8.el5xen #1 SMP Fri Jan 26 14:42:21 EST 2007 i686 i686 i386 GNU/Linux

[root@linux02 vtl]# rpm -ivh kernel-xen-devel-2.6.18-8.el5.i686.rpm
warning: kernel-xen-devel-2.6.18-8.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:kernel-xen-devel ########################################### [100%]

3、在linux下安装mhvtl虚拟带库及设备配置

在安装mhvtl之前,先安装如下软件包:

[root@linux02 mhvtl-0.18]# rpm -q zlib-devel
zlib-devel-1.2.3-3
[root@linux02 mhvtl-0.18]# rpm -q mt-st
package mt-st is not installed
[root@linux02 mhvtl-0.18]# rpm -q mtx
package mtx is not installed
[root@linux02 mhvtl-0.18]# rpm -q lsscsisg3_utils
package lsscsisg3_utils is not installed
[root@linux02 mhvtl_soft]# ls
lsscsi-0.17-3.el5.i386.rpm
mt-st-0.9b-2.2.2.i386.rpm
mtx-1.2.18-8.2.2.i386.rpm
zlib-devel-1.2.3-3.i386.rpm
[root@linux02 mhvtl_soft]# rpm -ivh mt-st-0.9b-2.2.2.i386.rpm
warning: mt-st-0.9b-2.2.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:mt-st ########################################### [100%]
[root@linux02 mhvtl_soft]# rpm -ivh mtx-1.2.18-8.2.2.i386.rpm
warning: mtx-1.2.18-8.2.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:mtx ########################################### [100%]
[root@linux02 mhvtl_soft]#
[root@linux02 mhvtl_soft]#
[root@linux02 mhvtl_soft]# rpm -ivh lsscsi-0.17-3.el5.i386.rpm
warning: lsscsi-0.17-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:lsscsi ########################################### [100%]
接着创建vtl用户:
groupadd vtl
useradd vtl -G vtl
passwd vtl
mkdir /opt/mhvtl
mkdir /etc/mhvtl
chown -Rf vtl:vtl /opt/mhvtl

chown -Rf vtl:vtl /etc/mhvtl
解压及安装:
[root@linux02 vtl]# mv mhvtl-0.18.zip mhvtl-0.18.tgz
[root@linux02 vtl]# tar zxvf mhvtl-0.18.tgz
[root@linux02 vtl]# cd mhvtl-0.18
[root@linux02 mhvtl-0.18]# ls -lsa
total 84
4 drwxr-xr-x 9 root root 4096 Aug 2 11:02 .
4 drwxr-xr-x 3 root root 4096 Aug 2 11:02 ..
4 drwxr-xr-x 3 1000 1000 4096 May 6 2010 doc
4 drwxr-xr-x 2 1000 1000 4096 Sep 2 2010 etc
4 drwxr-xr-x 2 1000 1000 4096 Feb 25 2009 include
8 -rw-r--r-- 1 1000 1000 5240 May 6 2010 INSTALL
4 drwxr-xr-x 2 1000 1000 4096 Sep 2 2010 kernel
4 -rw-r--r-- 1 1000 1000 2217 Jun 15 2010 Makefile
4 drwxr-xr-x 2 1000 1000 4096 Jun 22 2010 man
32 -rw-r--r-- 1 1000 1000 28676 Sep 2 2010 mhvtl.spec
4 -rw-r--r-- 1 1000 1000 647 Dec 17 2009 README
4 drwxr-xr-x 2 1000 1000 4096 Sep 2 2010 scripts
4 drwxr-xr-x 2 1000 1000 4096 Sep 2 2010 usr

[root@linux02 mhvtl-0.18]# make distclean
[root@linux02 mhvtl-0.18]# cd kernel/
[root@linux02 kernel]# date 061517322011.30
Wed Jun 15 17:32:30 CST 2011
[root@linux02 kernel]# date
Wed Jun 15 17:32:31 CST 2011
mailto:root@linux02]root@linux02 mhvtl-0.18]#cd ../
[root@linux02 mhvtl-0.18]#make;make install

安装完成后启动mhvtl:
[root@linux02 mhvtl-0.18]# /etc/init.d/mhvtl start
Could not locate library config file: /etc/mhvtl/library_contents.10
Creating a default one
Please stop mhvtl & edit /etc/mhvtl/library_contents.10 to suit your requirements
Could not locate library config file: /etc/mhvtl/library_contents.30
Creating a default one
Please stop mhvtl & edit /etc/mhvtl/library_contents.30 to suit your requirements
vtltape: version 0.18.10
vtltape: version 0.18.10
vtltape: version 0.18.10
vtltape: version 0.18.10
vtltape: version 0.18.10
vtltape: version 0.18.10
vtltape: version 0.18.10
vtltape: version 0.18.10
vtllibrary: version 0.18.10
vtllibrary process PID is 6628
vtllibrary: version 0.18.10
vtllibrary process PID is 6671

如果没有配置文件,会生成默认的配置。用lsscsi -g查看:

[root@linux02 mhvtl-0.18]# lsscsi -g
[1:0:0:0] disk DGC RAID 5 0219 /dev/sda /dev/sg0
[1:0:1:0] tape IBM ULT3580-TD3 73P5 /dev/st0 /dev/sg1
[1:0:1:1] mediumx IBM ULT3582-TL 310B - /dev/sg2
[2:0:0:0] mediumx STK L700 550V - /dev/sg11
[2:0:1:0] tape IBM ULT3580-TD5 550V /dev/st1 /dev/sg3
[2:0:2:0] tape IBM ULT3580-TD5 550V /dev/st2 /dev/sg4
[2:0:3:0] tape IBM ULT3580-TD4 550V /dev/st3 /dev/sg5
[2:0:4:0] tape IBM ULT3580-TD4 550V /dev/st4 /dev/sg6
[2:0:8:0] mediumx SPECTRA PYTHON 550V - /dev/sg12
[2:0:9:0] tape IBM ULT3580-TD4 550V /dev/st5 /dev/sg7
[2:0:10:0] tape IBM ULT3580-TD4 550V /dev/st6 /dev/sg8
[2:0:11:0] tape IBM ULT3580-TD4 550V /dev/st7 /dev/sg9
[2:0:12:0] tape IBM ULT3580-TD4 550V /dev/st8 /dev/sg10

[root@linux02 mhvtl-0.18]# lsscsi -l
[1:0:0:0] disk DGC RAID 5 0219 /dev/sda
state=running queue_depth=30 scsi_level=5 type=0 device_blocked=0 timeout=60
[1:0:1:0] tape IBM ULT3580-TD3 73P5 /dev/st0
state=running queue_depth=30 scsi_level=4 type=1 device_blocked=0 timeout=900
[1:0:1:1] mediumx IBM ULT3582-TL 310B -
state=running queue_depth=30 scsi_level=3 type=8 device_blocked=0 timeout=0
[2:0:0:0] mediumx STK L700 550V -
state=running queue_depth=32 scsi_level=6 type=8 device_blocked=0 timeout=0
[2:0:1:0] tape IBM ULT3580-TD5 550V /dev/st1
state=running queue_depth=32 scsi_level=6 type=1 device_blocked=0 timeout=900
[2:0:2:0] tape IBM ULT3580-TD5 550V /dev/st2
state=running queue_depth=32 scsi_level=6 type=1 device_blocked=0 timeout=900
[2:0:3:0] tape IBM ULT3580-TD4 550V /dev/st3
state=running queue_depth=32 scsi_level=6 type=1 device_blocked=0 timeout=900
[2:0:4:0] tape IBM ULT3580-TD4 550V /dev/st4
state=running queue_depth=32 scsi_level=6 type=1 device_blocked=0 timeout=900
[2:0:8:0] mediumx SPECTRA PYTHON 550V -
state=running queue_depth=32 scsi_level=6 type=8 device_blocked=0 timeout=0
[2:0:9:0] tape IBM ULT3580-TD4 550V /dev/st5
state=running queue_depth=32 scsi_level=6 type=1 device_blocked=0 timeout=900
[2:0:10:0] tape IBM ULT3580-TD4 550V /dev/st6
state=running queue_depth=32 scsi_level=6 type=1 device_blocked=0 timeout=900
[2:0:11:0] tape IBM ULT3580-TD4 550V /dev/st7
state=running queue_depth=32 scsi_level=6 type=1 device_blocked=0 timeout=900
[2:0:12:0] tape IBM ULT3580-TD4 550V /dev/st8
state=running queue_depth=32 scsi_level=6 type=1 device_blocked=0 timeout=900
这里的/dev/sg11和/dev/sg12是机械手。
这个默认的容量是500MB,这个可以查看mhvtl的配置文件mhvtl.conf:
capacity=500就是指默认容量为500MB,64个磁带。
cat /etc/mhvtl/mhvtl.conf

# Home directory for config file(s)
MHVTL_CONFIG_PATH=/etc/mhvtl
# Default media capacity (500 M)
CAPACITY=500
# Set default verbosity [0|1|2|3]
VERBOSE=1
# Set kernel module debuging [0|1]
VTL_DEBUG=0
可以更改。
简单应用:查看机械手状态:

[root@linux02 mhvtl-0.18]# mtx -f /dev/sg11 status
Storage Changer /dev/sg11:2 Drives, 39 Slots ( 0 Import/Export )
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Storage Element 1:Full :VolumeTag=E01001L4
Storage Element 2:Full :VolumeTag=E01002L4
Storage Element 3:Full :VolumeTag=E01003L4
Storage Element 4:Full :VolumeTag=E01004L4
Storage Element 5:Full :VolumeTag=E01005L4
Storage Element 6:Full :VolumeTag=E01006L4
Storage Element 7:Full :VolumeTag=E01007L4
Storage Element 8:Full :VolumeTag=E01008L4
Storage Element 9:Full :VolumeTag=E01009L4
Storage Element 10:Full :VolumeTag=E01010L4
Storage Element 11:Full :VolumeTag=E01011L4
Storage Element 12:Full :VolumeTag=E01012L4
Storage Element 13:Full :VolumeTag=E01013L4
Storage Element 14:Full :VolumeTag=E01014L4
Storage Element 15:Full :VolumeTag=E01015L4
Storage Element 16:Full :VolumeTag=E01016L4
Storage Element 17:Full :VolumeTag=E01017L4
Storage Element 18:Full :VolumeTag=E01018L4
Storage Element 19:Full :VolumeTag=E01019L4
Storage Element 20:Full :VolumeTag=E01020L4
Storage Element 21:Empty
Storage Element 22:Full :VolumeTag=CLN101L4
Storage Element 23:Full :VolumeTag=CLN102L5
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=F01030L5
Storage Element 31:Full :VolumeTag=F01031L5
Storage Element 32:Full :VolumeTag=F01032L5
Storage Element 33:Full :VolumeTag=F01033L5
Storage Element 34:Full :VolumeTag=F01034L5
Storage Element 35:Full :VolumeTag=F01035L5
Storage Element 36:Full :VolumeTag=F01036L5
Storage Element 37:Full :VolumeTag=F01037L5
Storage Element 38:Full :VolumeTag=F01038L5
Storage Element 39:Full :VolumeTag=F01039L5

[root@linux02 mhvtl-0.18]# mtx -f /dev/sg12 status
Storage Changer /dev/sg12:2 Drives, 39 Slots ( 0 Import/Export )
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Storage Element 1:Full :VolumeTag=E03001L4
Storage Element 2:Full :VolumeTag=E03002L4
Storage Element 3:Full :VolumeTag=E03003L4
Storage Element 4:Full :VolumeTag=E03004L4
Storage Element 5:Full :VolumeTag=E03005L4
Storage Element 6:Full :VolumeTag=E03006L4
Storage Element 7:Full :VolumeTag=E03007L4
Storage Element 8:Full :VolumeTag=E03008L4
Storage Element 9:Full :VolumeTag=E03009L4
Storage Element 10:Full :VolumeTag=E03010L4
Storage Element 11:Full :VolumeTag=E03011L4
Storage Element 12:Full :VolumeTag=E03012L4
Storage Element 13:Full :VolumeTag=E03013L4
Storage Element 14:Full :VolumeTag=E03014L4
Storage Element 15:Full :VolumeTag=E03015L4
Storage Element 16:Full :VolumeTag=E03016L4
Storage Element 17:Full :VolumeTag=E03017L4
Storage Element 18:Full :VolumeTag=E03018L4
Storage Element 19:Full :VolumeTag=E03019L4
Storage Element 20:Full :VolumeTag=E03020L4
Storage Element 21:Empty
Storage Element 22:Full :VolumeTag=CLN301L4
Storage Element 23:Full :VolumeTag=CLN302L5
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=F03030L5
Storage Element 31:Full :VolumeTag=F03031L5
Storage Element 32:Full :VolumeTag=F03032L5
Storage Element 33:Full :VolumeTag=F03033L5
Storage Element 34:Full :VolumeTag=F03034L5
Storage Element 35:Full :VolumeTag=F03035L5
Storage Element 36:Full :VolumeTag=F03036L5
Storage Element 37:Full :VolumeTag=F03037L5
Storage Element 38:Full :VolumeTag=F03038L5
Storage Element 39:Full :VolumeTag=F03039L5

将磁带从1号槽位装入driver 0:
mtx -f /dev/sg11 load 1 0
mtx -f /dev/sg11 status
[root@linux02 mhvtl-0.18]# mtx -f /dev/sg11 status
Storage Changer /dev/sg11:4 Drives, 43 Slots ( 4 Import/Export )
Data Transfer Element 0:Full (Storage Element 1 Loaded):VolumeTag = E01001L4
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
Storage Element 1:Empty
Storage Element 2:Full :VolumeTag=E01002L4
查看磁带状态:
mtx -f /dev/st1 status
[root@linux02 mhvtl-0.18]# mtx -f /dev/st1 status
mtx: Request Sense: Long Report=yes
mtx: Request Sense: Valid Residual=no
mtx: Request Sense: Error Code=0 (Unknown?!)
mtx: Request Sense: Sense Key=No Sense
mtx: Request Sense: FileMark=no
mtx: Request Sense: EOM=no
mtx: Request Sense: ILI=no
mtx: Request Sense: Additional Sense Code = 00
mtx: Request Sense: Additional Sense Qualifier = 00
mtx: Request Sense: BPV=no
mtx: Request Sense: Error in CDB=no
mtx: Request Sense: SKSV=no
INQUIRY command Failed
使用tar命令测试下,能否写入文件:

[root@linux02 mhvtl-0.18]# tar -cvvf /dev/st1 /tmp/vtl
[root@linux02 mhvtl-0.18]# tar -cvvf /dev/st1 /tmp/vtl
tar: Removing leading `/' from member names
drwxr-xr-x root/root 0 2007-08-02 11:06:59 /tmp/vtl/
drwxr-xr-x root/root 0 2007-08-02 11:07:16 /tmp/vtl/mhvtl_soft/
-rw-r--r-- root/root 27411 2007-01-18 03:09:17 /tmp/vtl/mhvtl_soft/lsscsi-0.17-3.el5.i386.rpm
-rw-r--r-- root/root 39582 2007-01-19 01:55:17 /tmp/vtl/mhvtl_soft/mt-st-0.9b-2.2.2.i386.rpm
-rw-r--r-- root/root 96440 2007-01-19 01:55:25 /tmp/vtl/mhvtl_soft/mtx-1.2.18-8.2.2.i386.rpm
-rw-r--r-- root/root 102853 2007-01-19 02:18:12 /tmp/vtl/mhvtl_soft/zlib-devel-1.2.3-3.i386.rpm
-rw-r--r-- root/root 12956811 2007-01-27 10:17:51 /tmp/vtl/kernel-xen-devel-2.6.18-8.el5.i686.rpm
查看数据:
[root@linux02 mhvtl]# cd E01001L4
[root@linux02 E01001L4]# ls -lsa
total 63552
4 drwxrwx--- 2 vtl vtl 4096 Jun 15 17:35 .
4 drwxr-xr-x 66 vtl vtl 4096 Jun 15 17:35 ..
60088 -rw-rw---- 1 vtl vtl 61461900 Jun 15 17:45 data
3452 -rw-rw---- 1 vtl vtl 3530240 Jun 15 17:45 indx
4 -rw-rw---- 1 vtl vtl 1540 Jun 15 17:45 meta
[root@linux02 E01001L4]# du sm *
du: cannot access `sm': No such file or directory
60088 data
3452 indx
4 meta
[root@linux02 E01001L4]#
[root@linux02 E01001L4]# pwd
/opt/mhvtl/E01001L4
写入成功了,测试是否能读取呢:
tar -tvvf /dev/st1
[root@linux02 E01001L4]# tar -tvvf /dev/st1
drwxr-xr-x root/root 0 2007-08-02 11:06:59 tmp/vtl/
drwxr-xr-x root/root 0 2007-08-02 11:07:16 tmp/vtl/mhvtl_soft/
-rw-r--r-- root/root 27411 2007-01-18 03:09:17 tmp/vtl/mhvtl_soft/lsscsi-0.17-3.el5.i386.rpm
-rw-r--r-- root/root 39582 2007-01-19 01:55:17 tmp/vtl/mhvtl_soft/mt-st-0.9b-2.2.2.i386.rpm

OK,读取成功。
接下来测试倒带:
mt -f /dev/st1 rewind
卸载磁带:
mtx -f /dev/sg11 unload 1 0
[root@linux02 E01001L4]# mtx -f /dev/sg11 unload 1 0
Unloading Data Transfer Element into Storage Element 1...done
[root@linux02 E01001L4]# mtx -f /dev/sg11 status
Storage Changer /dev/sg11: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=E01001L4
Storage Element 2:Full :VolumeTag=E01002L4

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】