首页 > 代码库 > 基于IP-SAN的存储Linux挂载

基于IP-SAN的存储Linux挂载

1、卸载原有存储

umount /home/weishaostore/


2、查看iSCSI session信息

iscsiadm -m session


3、设置InitiatorName

vim /etc/iscsi/initiatorname.iscsi

InitiatorName=iqn.2014-05.com.ruijie.whistle:whistle-100.e7839d5100

InitiatorName=iqn.2014-05.com.ruijie.whistle:whistle-150.e7839d5150

InitiatorName=iqn.2014-05.com.ruijie.whistle:whistle-200.e7839d5200


4、注销、删除登录信息

iscsiadm --mode node --targetname iqn.1992-04.com.emc:cx.fcn00132100133.a4 --portal 172.17.100.172:3260 --logout

iscsiadm --mode node --targetname iqn.1992-04.com.emc:cx.fcn00132100133.a4 --portal 172.17.100.172:3260 -o delete

iscsiadm --mode node --targetname iqn.1992-04.com.emc:cx.fcn00132100133.b4 --portal 172.17.100.173:3260 --logout

iscsiadm --mode node --targetname iqn.1992-04.com.emc:cx.fcn00132100133.b4 --portal 172.17.100.173:3260 -o delete

rm -rf /var/lib/iscsi/nodes/*

rm -rf /var/lib/iscsi/send_targets/* 


5、使用iSCSI存储之发现

iscsiadm -m discovery -t st -p 172.17.100.172 (发现)

iscsiadm --discover --mode discoverydb --type sendtargets --portal 172.17.100.172


6、使用iSCSI存储之登录

iscsiadm -m node -T iqn.1992-04.com.emc:cx.fcn00132100133.a4 -p 172.17.100.172 -l (登录)

iscsiadm --login --mode node --targetname iqn.1992-04.com.emc:cx.fcn00132100133.a4 --portal 172.17.100.172:3260


7、格式化

parted /dev/sdb -s mklabel gpt

parted /dev/sdb -s -- mkpart primary 10 -1

mkfs.ext4 /dev/sdb1


8、用tune2fs修改文件系统的属性,去掉自动检查的属性:

[root@pe03 Server]# tune2fs -c -1 -i 0 /dev/sdb1


9、用tune2fs查看文件系统的UUID:

[root@pe03 Server]# tune2fs -l /dev/sdb1


UUID=3f0a00b7-4939-4ad2-a592-0821bb79f7c6 /data ext3 _netdev 0 0


10、挂载、添加挂载清单

# mkdir /home/weishaostore

# DiskID=`blkid /dev/sdb1 | awk ‘{print $2}‘`;echo "$DiskID /home/weishaostore ext4 _netdev 0 0" >> /etc/fstab

# service iscsi restart;df –hP

PS:如果出现如图红线框内的显示,说明存储挂载成功


本文出自 “心静梵音” 博客,请务必保留此出处http://mastters.blog.51cto.com/6516495/1414020