点击(此处)折叠或打开
-
apt-get install open-iscsi
- apt-get install multipath-tools
此外为了让iscsi设备能自动挂载(特别是启动时),需要编辑/etc/iscsi/iscsid.conf文件,设置:
点击(此处)折叠或打开
- node.startup = automatic
点击(此处)折叠或打开
- /etc/init.d/open-iscsi restart
点击(此处)折叠或打开
-
iscsiadm -m discovery -t sendtargets -p
例如
点击(此处)折叠或打开
- iscsiadm -m discovery -t sendtargets -p 192.168.1.3
点击(此处)折叠或打开
-
192.168.1.3:3260,1 iqn.1986-03.com.ibm:1145.cluster192.168.1.1.node2
192.168.1.5:3260,1 iqn.1986-03.com.ibm:1145.cluster192.168.1.1.node2
因为前面配置了自动挂载,所以现在重启open-iscsi服务会自动挂载,如果要手动挂载则
点击(此处)折叠或打开
- iscsiadm -m node -T iqn.1986-03.com.ibm:1145.cluster192.168.1.1.node2 -p 192.168.13:3260,1 -l
一般挂载后,会在/dev/ 下面产生 /dev/sd* 的文件,也可以用 fdisk -l 列出。比如我实验环境的相关输出就是
点击(此处)折叠或打开
-
Disk /dev/sdb: 4295.0 GB, 4294967296000 bytes
255 heads, 63 sectors/track, 522166 cylinders, total 8388608000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 67108864 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 1 4294967295 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.
Disk /dev/mapper/mpatha: 4295.0 GB, 4294967296000 bytes
255 heads, 63 sectors/track, 522166 cylinders, total 8388608000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 67108864 bytes
Disk identifier: 0x00000000
这里注意的是虽然这里有了 /dev/sdb,但不能直接对/dev/sdb操作,因为现在是多路径,只能对多路径的挂载点进行操作,多路径的挂载点可以是/dev/dm-X 或者 /dev/mapper/mpathX
所以我们可以执行:
点击(此处)折叠或打开
-
parted /dev/dm-X
点击(此处)折叠或打开
-
parted /dev/mapper/mpathX
点击(此处)折叠或打开
-
/dev/dm-1 /data4t ext4 defaults 0 2
点击(此处)折叠或打开
-
mount -a