标签:mkf add 行操作 style state system ipaddr example roo
1 [root@system2 ~]# yum -y install iscsi-initiator-utils
二 修改相关参数
1 [root@system2 ~]# vi /etc/iscsi/initiatorname.iscsi 2 InitiatorName=iqn.2016-09.com.example:desktop0 #设置为服务端赋予权限的IQN
1 [root@system2 ~]# systemctl enable iscsi 2 [root@system2 ~]# systemctl start iscsi
1 [root@system2 ~]# iscsiadm -m discovery -t sendtargets -p 172.24.8.11 #发现目标或者iscsiadm -m discovery -t st -p 172.24.8.11 2 172.24.8.11:3260,1 iqn.2016-09.com.example:remotedisk1
1 [root@system2 ~]# iscsiadm -m node -T iqn.2016-09.com.example:remotedisk1 -p 172.24.8.11 -l #登陆目标或 2 iscsiadm -m node --targetname iqn.2016-09.com.example:remotedisk1 -p 172.24.8.11 --login
1 [root@system2 ~]# iscsiadm -m session -P 3 #查询信息 2 iSCSI Transport Class version 2.0-870 3 version 6.2.0.873-21 4 Target: iqn.2016-09.com.example:remotedisk1 (non-flash) 5 Current Portal: 172.24.8.11:3260,1 6 Persistent Portal: 172.24.8.11:3260,1 7 …… 8 Iface Initiatorname: iqn.2016-09.com.example:desktop0 9 Iface IPaddress: 172.24.8.12 10 …… 11 Attached SCSI devices: 12 ************************ 13 Host Number: 33 State: running 14 scsi33 Channel 00 Id 0 Lun: 0 15 Attached scsi disk sdb State: running 16 scsi33 Channel 00 Id 0 Lun: 1 17 Attached scsi disk sdc State: running 18 scsi33 Channel 00 Id 0 Lun: 2 19 Attached scsi disk sdd State: running 20 [root@system2 ~]# fdisk -l #发现的iSCSI服务器三个共享 21 …… 22 Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors 23 …… 24 Disk /dev/sdc: 3221 MB, 3221225472 bytes, 6291456 sectors 25 …… 26 Disk /dev/sdd: 1073 MB, 1073741824 bytes, 2097152 sectors 27 ……
注意:
1 此时能当做本地磁盘使用,分区格式化等操作
2 亦可使用RAID或LVM来进行操作,LVM的可在之后格式化LV
1 [root@system2 ~]# mkfs.ext4 /dev/sdb #格式化相关iSCSI磁盘 2 [root@system2 ~]# mkdir -p /iscsdisk/sdb01 #创建用于挂载sdd磁盘的挂载点 3 [root@system2 ~]# mkdir -p /iscsdisk/lv01 #创建用于挂载LVM分区的挂载点 4 [root@system2 ~]# mount /dev/sdb /iscsdisk/sdb01/ #可直接挂载 5 [root@system2 ~]# pvcreate /dev/sd{c,d} 6 …… 7 [root@system2 ~]# vgcreate iscs-vg01 -s 16M /dev/sd{c,d} 8 Volume group "iscs-vg01" successfully created 9 [root@system2 ~]# lvcreate -n iscs-lv01 -L +4G iscs-vg01 10 Logical volume "iscs-lv01" created 11 [root@system2 ~]# mkfs.xfs /dev/iscs-vg01/iscs-lv01 #以上均为LVM创建过程 12 …… 13 [root@system2 ~]# mount /dev/iscs-vg01/iscs-lv01 /iscsdisk/lv01/ #挂载 14 [root@system2 ~]# df -Th 15 …… 16 /dev/mapper/iscs--vg01-iscs--lv01 xfs 4.0G 33M 4.0G 1% /iscsdisk/lv01 17 /dev/sdb ext4 976M 2.6M 907M 1% /iscsdisk/sdb01
1 [root@system2 ~]# blkid #获取UUID 2 /dev/sdb: UUID="2kChJ9-SzFy-eiYP-UqNR-FOJn-bbSt-Uu7WMm" TYPE="LVM2_member" 3 /dev/sda1: UUID="182dc058-fb2e-45ec-8285-38f150033822" TYPE="xfs" 4 /dev/sda2: UUID="ded4e9e7-b20f-405f-b88b-99e26dd67bd5" TYPE="swap" 5 /dev/sdc: UUID="Cuxf8e-gd23-tWi3-GGHf-LRmq-t2X2-MoWguv" TYPE="LVM2_member" 6 /dev/mapper/iscs--vg01-iscs--lv01: UUID="e0dd92fd-12fd-45a7-aaa4-f58680fdee63" TYPE="xfs" 7 /dev/sdd: UUID="6fc59bef-b502-4b54-81c1-5b3ecf0da0e7" TYPE="ext4" 8 [root@system2 ~]# vi /etc/fstab #自动挂载 9 …… 10 UUID=e0dd92fd-12fd-45a7-aaa4-f58680fdee63 /iscsdisk/lv01 xfs defaults 0 0 11 UUID=6fc59bef-b502-4b54-81c1-5b3ecf0da0e7 /iscsdisk/sdd01 ext4 defaults 0 0
标签:mkf add 行操作 style state system ipaddr example roo
原文地址:https://www.cnblogs.com/itzgr/p/9893163.html