Linux‎ > ‎

安裝Virtual Tape Library

本例使用mhVTL套件

    

    1.      安裝必要套件

# yum –y install gcc mtx mt-st zlib-devel sg3_devel kernel-devel

# yum –y install lsscsi kernel-headers kernel

 

2.      下載mhVTL相關套件程式

https://sites.google.com/site/linuxvtl2/home#mhvtl-download

package

 Description

mhvtl-utils-1.4-4.x86_64.rpm

64bit pre-built binaries of 'user space' portion of mVTL

mhvtl-utils-1.4-4.i586.rpm

32bit pre-built binaries of 'user space' portion of mVTL

mhvtl-utils-1.4-4.src.rpm

Above source code tar ball packaged as a source rpm

git tarball

Latest source tree (retrieved via git) as a 'tar ball'

 

3.      安裝mhVTL (RPM based Linux distributions)

# rpm –ivh mhvtl-utils-1.4-4.x86_64.rpm

# rpm –ivh mhvtl-utils-1.4-4.src.rpm

# cd /root/rpmbuild/SOURCE

# tar zxvf mhvtl-2012-09-13.tgz

# cd /root/rpmbuild/SOURCE/mhvtl-1.4/kernel/

# make

# make install

 

4.      啟動mhVTL服務

# /etc/init.d/mhvtl start

vtllibrary process PID is 6168

vtllibrary process PID is 6171

 

5.      確認mhVTL是否正常執行

# lsscsi -g

[0:0:0:0]    disk    ATA      WDC WD5000AAKS-7 01.0  /dev/sda   /dev/sg0

[2:0:0:0]    cd/dvd  PLDS     DVD+-RW DH-16A6S YD11  /dev/sr0   /dev/sg1

[7:0:0:0]    mediumx STK      L700             0104  /dev/sch0  /dev/sg10

[7:0:1:0]    tape    IBM      ULT3580-TD5      0104  /dev/st0   /dev/sg2

[7:0:2:0]    tape    IBM      ULT3580-TD5      0104  /dev/st1   /dev/sg3

[7:0:3:0]    tape    IBM      ULT3580-TD4      0104  /dev/st2   /dev/sg4

[7:0:4:0]    tape    IBM      ULT3580-TD4      0104  /dev/st3   /dev/sg5

[7:0:8:0]    mediumx STK      L80              0104  /dev/sch1  /dev/sg11

[7:0:9:0]    tape    STK      T10000B          0104  /dev/st4   /dev/sg6

[7:0:10:0]   tape    STK      T10000B          0104  /dev/st5   /dev/sg7

[7:0:11:0]   tape    STK      T10000B          0104  /dev/st6   /dev/sg8

[7:0:12:0]   tape    STK      T10000B          0104  /dev/st7   /dev/sg9

 

# ps -ef | grep vtl

vtl       6132     1  0 20:29 ?        00:00:00 vtltape -q 11 -v

vtl       6135     1  0 20:29 ?        00:00:00 vtltape -q 12 -v

vtl       6139     1  0 20:29 ?        00:00:00 vtltape -q 13 -v

vtl       6142     1  0 20:29 ?        00:00:00 vtltape -q 14 -v

vtl       6145     1  0 20:29 ?        00:00:00 vtltape -q 31 -v

vtl       6148     1  0 20:29 ?        00:00:00 vtltape -q 32 -v

vtl       6151     1  0 20:29 ?        00:00:00 vtltape -q 33 -v

vtl       6154     1  0 20:29 ?        00:00:00 vtltape -q 34 -v

vtl       6168     1  0 20:29 ?        00:00:00 vtllibrary -q 10 -v

vtl       6171     1  0 20:29 ?        00:00:00 vtllibrary -q 30 -v

root      6240  5175  0 20:29 pts/1    00:00:00 grep vtl

 

6.      使用mhVTL

A.        確認mhvtl磁帶櫃狀態

[root@localhost /]# mtx -f /dev/sg10 status

Storage Changer /dev/sg9:2 Drives, 39 Slots ( 0 Import/Export )Data Transfer Element 0:EmptyData 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                            

 

B.         1號磁帶掛載至0號磁帶頭上

[root@localhost dev]# mtx -f /dev/sg9 load 1 0

Loading media from Storage Element 1 into drive 0...done

 

C.        確認磁帶狀態

[root@localhost dev]# mt -f /dev/nst0 status

SCSI 2 tape drive:File number=0, block number=0, partition=0.Tape block size 0 bytes. Density code 0x48 (Quantum SDLT220).

Soft error count since last status=0General status bits on (41010000): BOT ONLINE IM_REP_EN

[root@localhost dev]# 如果你的File number=-1,block number=-1代表該磁帶頭沒有掛載磁帶。

 

 

D.        向磁帶寫入資料

mt -f /dev/nst0 tel  : 顯示磁帶頭在磁帶的那個block位置

mt -f /dev/nst0 rewind :倒帶

mt -f /dev/nst0 eod  將磁帶轉到最後的block的末端

mt -f /dev/nst0 erase :格式化磁帶向磁帶寫入資料

 

[root@localhost dev]# tar -cvvf /dev/nst0 /boot

tar: Removing leading 

`/' from member namesdrwxr-xr-x root/root         0 2010-11-16 07:11:41 /boot/

-rw-r--r-- root/root     69593 2010-03-17 09:57:37 /boot/config-2.6.18-194.el5

-rw-r--r-- root/root    110979 2010-03-17 09:57:51 /boot/symvers-2.6.18-194.el5.gz

-rw-r--r-- root/root    967675 2010-03-17 09:57:37 /boot/System.map-2.6.18-194.el5d

rwxr-xr-x root/root         0 2010-11-16 07:18:31 /boot/grub/

-rw-r--r-- root/root      7456 2010-11-16 07:18:31 /boot/grub/fat_stage1_5

-rw-r--r-- root/root      6720 2010-11-16 07:18:31 /boot/grub/iso9660_stage1_5

-rw-r--r-- root/root      6880 2010-11-16 07:18:31 /boot/grub/minix_stage1_5

-rw-r--r-- root/root      8904 2010-11-16 07:18:31 /boot/grub/xfs_stage1_5

-rw-r--r-- root/root      6720 2010-11-16 07:18:31 /boot/grub/ffs_stage1_5

-rw-r--r-- root/root        63 2010-11-16 07:18:31 /boot/grub/device.map

-rw-r--r-- root/root       512 2010-11-16 07:18:31 /boot/grub/stage1

-rw-r--r-- root/root      8192 2010-11-16 07:18:31 /boot/grub/jfs_stage1_5

-rw------- root/root       625 2010-11-16 07:18:31 /boot/grub/grub.conf

-rw-r--r-- root/root      6272 2010-11-16 07:18:31 /boot/grub/vstafs_stage1_5l

rwxrwxrwx root/root         0 2010-11-16 07:18:31 /boot/grub/menu.lst -> ./grub.conf

-rw-r--r-- root/root      7072 2010-11-16 07:18:31 /boot/grub/ufs2_stage1_5

-rw-r--r-- root/root      9248 2010-11-16 07:18:31 /boot/grub/reiserfs_stage1_5

-rw-r--r-- root/root    104988 2010-11-16 07:18:31 /boot/grub/stage2

-rw-r--r-- root/root     32428 2007-01-05 03:13:33 /boot/grub/splash.xpm.gz

-rw-r--r-- root/root      7584 2010-11-16 07:18:31 /boot/grub/e2fs_stage1_5

-rw-r--r-- root/root   1875796 2010-03-17 09:57:37 /boot/vmlinuz-2.6.18-194.el5

-rw-r--r-- root/root       158 2010-03-17 09:57:37 /boot/.vmlinuz-2.6.18-194.el5.hmac

-rw------- root/root   2664013 2010-11-16 20:16:25 /boot/initrd-2.6.18-194.el5.img

 

E.         查看磁帶上的資料需要將磁帶轉到開始處才行

[root@localhost dev]# mt -f /dev/nst0 rewind

[root@localhost dev]# mt -f /dev/nst0 tel

At block 0.

[root@localhost dev]# tar -tvvf /dev/nst0

drwxr-xr-x root/root         0 2010-11-16 07:11:41 boot/

-rw-r--r-- root/root     69593 2010-03-17 09:57:37 boot/config-2.6.18-194.el5

-rw-r--r-- root/root    110979 2010-03-17 09:57:51 boot/symvers-2.6.18-194.el5.gz

-rw-r--r-- root/root    967675 2010-03-17 09:57:37 boot/System.map-2.6.18-194.el5d

rwxr-xr-x root/root         0 2010-11-16 07:18:31 boot/grub/

-rw-r--r-- root/root      7456 2010-11-16 07:18:31 boot/grub/fat_stage1_5

-rw-r--r-- root/root      6720 2010-11-16 07:18:31 boot/grub/iso9660_stage1_5

-rw-r--r-- root/root      6880 2010-11-16 07:18:31 boot/grub/minix_stage1_5

-rw-r--r-- root/root      8904 2010-11-16 07:18:31 boot/grub/xfs_stage1_5

-rw-r--r-- root/root      6720 2010-11-16 07:18:31 boot/grub/ffs_stage1_5

-rw-r--r-- root/root        63 2010-11-16 07:18:31 boot/grub/device.map

-rw-r--r-- root/root       512 2010-11-16 07:18:31 boot/grub/stage1

-rw-r--r-- root/root      8192 2010-11-16 07:18:31 boot/grub/jfs_stage1_5

-rw------- root/root       625 2010-11-16 07:18:31 boot/grub/grub.conf

-rw-r--r-- root/root      6272 2010-11-16 07:18:31 boot/grub/vstafs_stage1_5l

rwxrwxrwx root/root         0 2010-11-16 07:18:31 boot/grub/menu.lst -> ./grub.conf

-rw-r--r-- root/root      7072 2010-11-16 07:18:31 boot/grub/ufs2_stage1_5

-rw-r--r-- root/root      9248 2010-11-16 07:18:31 boot/grub/reiserfs_stage1_5

-rw-r--r-- root/root    104988 2010-11-16 07:18:31 boot/grub/stage2

-rw-r--r-- root/root     32428 2007-01-05 03:13:33 boot/grub/splash.xpm.gz

-rw-r--r-- root/root      7584 2010-11-16 07:18:31 boot/grub/e2fs_stage1_5

-rw-r--r-- root/root   1875796 2010-03-17 09:57:37 boot/vmlinuz-2.6.18-194.el5

-rw-r--r-- root/root       158 2010-03-17 09:57:37 boot/.vmlinuz-2.6.18-194.el5.hmac

-rw------- root/root   2664013 2010-11-16 20:16:25 boot/initrd-2.6.18-194.el5.img

 

F.         卸載磁帶

[root@localhost dev]# mtx -f /dev/sg9 unload 1 0

Unloading drive 0 into Storage Element 1...done

 

7          安裝mhVTL Web Console

MHVTL GUI Requirement  :

========================

 

I.            You will need a PHP enabled web server (Required )

   Please test with "phpinfo();"

 

II.         Setup sudo (Required ) :

* Allow your web server user id to run commands locally as root

  e.g.: Run # echo "apache ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers

* Comment out the line "Defaults requiretty" in /etc/sudoers

* You may need to disable selinux to run sudo from httpd, Reported by crippa.andrea/MHVTL Forum

III.       Install some OS utility tools :

* lsscsi (yum install lsscsi) (Required)

* mtx (yum install mtx) (Required)

* mt-st (yum install mt-st) (Required)

* git version 1.7.4.1 or higher yum install git (Optional - for LIVE UPDATE Feature)

* sysstat (yum install sysstat) (Optional)

* sg3_utils (Optional) yum install sg3_utils

 

IV.      Install MHVTL / Minimum Release 0.18 Version 15 ] e.g. Version: 0.18.15-git-xxxxxx (Required )

* Download MHVTL via Public git Repositories https://github.com/markh794 or see http://sites.google.com/site/linuxvtl2/

 

V.        Internet connectivity for LIVE UPDATE Feature (Optional)

 

VI.      tgt 1.17 or higher from http://stgt.sourceforge.net/ (Optional) used for iSCSI Target

 

VII.   Supported Internet Browser : Internet Explorer 8, FireFox, and Google Chrome (Application mode ) for better experience

 

 

MHVTL Web Console UI Installation :

===================================

I.            Add a directory alias in your web server configuration file for MHVTL GUI:

 

Example :

#vim /etc/httpd/conf/httpd.conf

 

Alias /mhvtl "/var/www/html/mhvtl"

<Directory "/var/www/html/mhvtl">

   Options None

   AllowOverride None

   Order allow,deny

   Allow from all

</Directory>

 

II.         Copy all MHVTL GUI files to the aliased directory specified above.

 

III.       Access MHVTL GUI via your Internet Browser e.g. http://localhost/mhvtl/ or http://10.0.0.10/mhvtl/

 

IV.      Log on with password: "mhvtl"

*** To change password, update file ~go.php where it says "if ( $password == "mhvtl" )"

 

Comments