在ubuntu里安装虚拟磁带库,使用的软件是mhVTL
1. 下载 mhVTL
下载地址如下,下载文件名为mhvtl-2016-03-10.tar
http://www.mhvtl.com/download/
2. 安装必要的包和应用
root@db2a:~# apt-get install zlib1g-dev liblzma-dev liblzo2-dev make gcc libsgutils2-2 mt-st mtx lsscsi
3. 创建用户
root@db2a:~# groupadd -r vtl
root@db2a:~# useradd -r -c "Virtual Tape Library" -d /opt/mhvtl -g vtl vtl -s /bin/bash
root@db2a:~# chown vtl:vtl /opt/mhvtl/
4. 解压并安装
root@db2a:~# tar -xvf mhvtl-2016-03-10.tar
root@db2a:~# cd mhvtl-1.5/kernel <--进入到mhvtl-1.5/kernel编译内核
root@db2a:~/mhvtl-1.5/kernel# make
root@db2a:~/mhvtl-1.5/kernel# make install
root@db2a:~/mhvtl-1.5/kernel# cd .. <--进入到mhvtl-1.5目录安装
root@db2a:~/mhvtl-1.5# make
root@db2a:~/mhvtl-1.5# make install
5. 启动
root@db2a:~/mhvtl-1.5# /etc/init.d/mhvtl start
6. 查看
root@db2a:~# lsscsi -g
[2:0:0:0] cd/dvd NECVMWar VMware SATA CD00 1.00 /dev/sr0 /dev/sg0
[3:0:0:0] cd/dvd NECVMWar VMware SATA CD01 1.00 /dev/sr1 /dev/sg1
[32:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda /dev/sg2
[34:0:0:0] mediumx STK L700 0105 /dev/sch0 /dev/sg11
[34:0:1:0] tape IBM ULT3580-TD5 0105 /dev/st0 /dev/sg3
[34:0:2:0] tape IBM ULT3580-TD5 0105 /dev/st1 /dev/sg4
[34:0:3:0] tape IBM ULT3580-TD4 0105 /dev/st2 /dev/sg5
[34:0:4:0] tape IBM ULT3580-TD4 0105 /dev/st3 /dev/sg6
[34:0:8:0] mediumx STK L80 0105 /dev/sch1 /dev/sg12
[34:0:9:0] tape STK T10000B 0105 /dev/st4 /dev/sg7
[34:0:10:0] tape STK T10000B 0105 /dev/st5 /dev/sg8
[34:0:11:0] tape STK T10000B 0105 /dev/st6 /dev/sg9
[34:0:12:0] tape STK T10000B 0105 /dev/st7 /dev/sg10
可以看到2个机械臂 (/dev/sg11和/dev/sg12) 、8个驱动器
查看其中一个机械臂状态
root@db2a:~# 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
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
Storage Element 40 IMPORT/EXPORT:Empty
Storage Element 41 IMPORT/EXPORT:Empty
Storage Element 42 IMPORT/EXPORT:Empty
Storage Element 43 IMPORT/EXPORT:Empty
可以看到有4个驱动器,43个槽位
将1槽位的磁带放到0驱动器中(Media Changer Tools)
root@db2a:~/mhvtl-1.5# mtx -f /dev/sg11 load 1 0
Loading media from Storage Element 1 into drive 0...done
root@db2a:~/mhvtl-1.5# mtx -f /dev/sg11 status | more
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
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
...
本文部分资料参考于网络