标签:
server:
环境:rhel7.2 软件包:targetcli-2.1.fb41-3.el7.noarch,selinux-policy-targeted-3.13.1-60.el7.noarch
1.yum install -y targetcli
2.systemctl enabled target
3.firewall-cmd --permanent --add-rich-rule ‘rule family=ipv4 source address=192.168.1.0/24 service name=targetd accept‘ && firewall-cmd --reload
4.fdisk /dev/vda 分出一个1GB 容量的分区,注意!不用格式化!
5.partprobe /dev/sda
6.targetcli
/> ls
/> /backstores/block create data_block /dev/sda9
/> iscsi/ create iqn.2016-05.com.example.com:system1
/> iscsi/iqn.2016-05.com.example.com:system1/tpg1/acls create iqn.2016-05.com.example.com:system2
/> iscsi/iqn.2016-05.com.example.com:system1/tpg1/luns create /backstores/block/data_block
/> iscsi/iqn.2016-05.com.example.com:system1/tpg1/portals/ create 192.168.1.101 如果这步出错,则执行以下红色字体命令↓再执行本句命令
/> iscsi/iqn.2016-05.com.example.com:system1/tpg1/portals/ delete ip_address=0.0.0.0 ip_port=3260
/> saveconfig
/> exit 服务端配置完成!
client:
环境:rhel7 软件包:iscsi-initiator-utils-iscsiuio-6.2.0.873-32.el7.x86_64 ,iscsi-initiator-utils-6.2.0.873-32.el7.x86_64
1.yum install -y iscsi-initiator*
2.执行:iscsiadm -m discovery -t st -p system1.example.com 这条命令:获取-->>192.168.1.101:3260,1 iqn.2016-05.com.example.com:system1
3.修改:vim /etc/iscsi/initiatorname.iscsi 填入客户机iqn: InitiatorName= iqn.2016-05.com.example.com:system2
4.连接服务端:iscsiadm -m node -T iqn.2016-05.com.example.com:system1 -p system1.example.com -l
5.fdsik -l
6.fdisk /dev/sdb 创建一个500M分区-->/dev/sdb1 --> mkfs.xfs /dev/sdb1
7.查uuid: blkid
/dev/sdb1: UUID="eb5377bc-ac3e-4e35-bc46-a93218109589" TYPE="xfs"
mkdir /test
7.vim /etc/fstab
UUID="eb5377bc-ac3e-4e35-bc46-a93218109589" /test xfs defaults,_netdev 0 0
mount -a 查看是否正确
标签:
原文地址:http://www.cnblogs.com/qiuyang-linux/p/5589028.html