1.[root@localhost ~]#yum -y install scsi-target-utils //安装服务端target包。
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
scsi-target-utils i686 1.0.24-2.el6 base 166 k
Installing for dependencies:
libibverbs i686 1.1.6-4.el6 base 45 k
librdmacm i686 1.0.15-2.el6 updates 29 k
lsof i686 4.82-4.el6 base 315 k
perl i686 4:5.10.1-127.el6 base 9.7 M
perl-Config-General noarch 2.44-1.el6 base 68 k
perl-Module-Pluggable i686 1:3.90-127.el6 base 38 k
perl-Pod-Escapes i686 1:1.04-127.el6 base 30 k
perl-Pod-Simple i686 1:3.13-127.el6 base 210 k
perl-libs i686 4:5.10.1-127.el6 base 591 k
perl-version i686 3:0.77-127.el6 base 49 k
sg3_utils i686 1.28-4.el6 base 471 k
sg3_utils-libs i686 1.28-4.el6 base 50 k
Transaction Summary
2.[root@localhost ~]# chkconfig tgtd on //tgtd开机启动
3.[root@localhost ~]# service tgtd start //启动tgtd服务
Starting SCSI target daemon: [ OK ]
4.[root@localhost ~]# fdisk /dev/sdb //添加一块硬盘fdisk命令创建一个sdb1 20g 分区,或者在文件系统上创建一个镜像文件。
5.[root@localhost /]# mkdir -p /home/zh888 //创建zh888目录
[root@localhost /]# dd if=/dev/zero of=/home/zh888/zh888.img bs=1M count=1000 //创建一个zh888.img镜像文件
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 6.81786 s, 154 MB/s
6.[root@localhost /]# restorecon -R /home/zh888/
7.[root@localhost /]# ll -Z /home/zh888
-rw-r--r-- root root ? zh888.img
