Last active
October 18, 2016 11:39
-
-
Save archerslaw/831e0c7302579a6abee2 to your computer and use it in GitHub Desktop.
How to generate a tape device.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.install and setup the scsi target | |
# rpm -q scsi-target-utils || yum -y install scsi-target-utils (perl-Config-General) | |
2.disable iptables and selinux. | |
# service iptables stop | |
# chkconfig iptables off | |
# setenforce 0 | |
3.setup the tape target. | |
# service tgtd start | |
# tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.st:tape:sttarget1 | |
# tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL | |
# dd if=/dev/zero of=/root/tape.device bs=1M count=100 | |
# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --device-type tape --lun 1 -b /root/tape.device | |
# tgtadm --lld iscsi --op show --mode target | |
Target 1: iqn.st:tape:sttarget1 | |
System information: | |
Driver: iscsi | |
State: ready | |
I_T nexus information: | |
LUN information: | |
LUN: 0 | |
Type: controller | |
SCSI ID: IET 00010000 | |
SCSI SN: beaf10 | |
Size: 0 MB, Block size: 1 | |
Online: Yes | |
Removable media: No | |
Prevent removal: No | |
Readonly: No | |
Backing store type: null | |
Backing store path: None | |
Backing store flags: | |
LUN: 1 | |
Type: tape | |
SCSI ID: IET 00010001 | |
SCSI SN: beaf11 | |
Size: 1049 MB, Block size: 1 | |
Online: Yes | |
Removable media: Yes | |
Prevent removal: No | |
Readonly: No | |
Backing store type: ssc | |
Backing store path: /root/tape.device | |
Backing store flags: | |
Account information: | |
ACL information: | |
ALL | |
4.install and setup the iscsi initiator | |
# rpm -q iscsi-initiator-utils || yum -y install iscsi-initiator-utils | |
# iscsiadm -m discovery -t st -p 127.0.0.1 | |
Starting iscsid: [ OK ] | |
127.0.0.1:3260,1 iqn.st:tape:sttarget1 | |
# iscsiadm -m node -l | |
Logging in to [iface: default, target: iqn.st:tape:sttarget1, portal: 127.0.0.1,3260] (multiple) | |
Login to [iface: default, target: iqn.st:tape:sttarget1, portal: 127.0.0.1,3260] successful. | |
# rpm -q lsscsi || yum install -y lsscsi | |
# lsscsi | grep -w tape | |
[11:0:0:1] tape IET VIRTUAL-TAPE 0001 /dev/st0 | |
5.launch a KVM guest with this tape device passthrough to guest(note: cache=none not support for scsi-generic). | |
e.g:...-drive file=/dev/sg3,if=none,id=drive-data-disk,format=raw -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x7 -device scsi-generic,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-data-disk,id=data-disk | |
6.login to guest to check the tape device work well. | |
# lsscsi | grep -w tape | |
# tar cvf /dev/st0 /root/sluo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment