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
|