运维开发网

【linux】Centos7 iscsi服务搭建

运维开发网 https://www.qedev.com 2020-06-19 13:10 出处:网络
Server:#yum -y install targetcli#systemctl stop firewalld.service#systemctl start target.service#systemctl enable target.service#fdisk /dev/vdbnp1+3Gw#partprobe /dev/vdb#ls /dev/vdb(TAB)#pvcreate /dev

Server:

#yum -y install targetcli

#systemctl stop firewalld.service

#systemctl start target.service

#systemctl enable target.service

#fdisk /dev/vdb

n

p

1

+3G

w

#partprobe /dev/vdb

#ls /dev/vdb(TAB)

#pvcreate /dev/vdb1

#vgcreate iscsi_vg /dev/vdb1

#lvcreate -L 2G -n iscsi_lvm iscsi_vg

#targetcli

>/backstores/block create serverX.disk1 /dev/iscsi_vg/iscsi_lvm

>/iscsi create iqn.2017-07.com.example:serverX

>/iscsi/iqn.2017-07.com.example:serverX/tpg1/acls create iqn.2017-07.com.example:desktopX

>/iscsi/iqn.2017-07.com.example:serverX/tpg1/luns create /backstores/block/serverX.disk1

>/iscsi/iqn.2017-07.com.example:serverX/tpg1/portals create 172.25.X.11

>saveconfig

>exit

Desktop:

#yum -y install iscsi-initiator-utils.x86_64

#vim /etc/iscsi/initiatorname.iscsi

InitiatorName=iqn.2017-07.com.example:desktop0

#iscsiadm -m discovery -t st -p 172.25.X.11

#systemctl restart iscsid

#systemctl restart iscsi

#systemctl enable iscsid

#systemctl enable iscsi

#iscsiadm -m discovery -t st -p 172.25.X.11

#iscsiadm -m node -T iqn.2017-07.com.example:serverX -p 172.25.X.11

#iscsiadm -m node -T iqn.2017-07.com.example:serverX -p 172.25.X.11 -l

#fdisk -l | dmesg | lsblk

#fdisk /dev/sdX

n

p

1

+xG

w

#partprobe /dev/sdX

#mkfs.xfs /dev/sdXX

#blkid /dev/sdXX >> /etc/fstab

UUID="" /mnt/iscsi xfs defaults,_netdev 0 0

#mkdir /mnt/iscsi

#mount -a

#df -h

#reboot

#df -h

0

精彩评论

暂无评论...
验证码 换一张
取 消