chkconfig iscsid on
chkconfig iscsi on修改配置文件
vim /etc/iscsi/iscsid.conf
#iscsid.conf
# To manually startup the session set to "manual". The default is automatic.
node.startup = automatic
# To enable CHAP authentication
node.session.auth.authmethod = CHAP //开启账户验证
# To set a CHAP username and password for initiator
node.session.auth.username = iscsiadm
node.session.auth.password = iscsiadm123
客户端查找目标存储iscsiadm -m discovery -t sendtargets -p 192.168.199.128 #目标IP
查看核对信息iscsiadm -m node -o show
登录
#登录全部扫描到的服务器iscsiadm -m node --login #登录某一个 #iscsiadm --mode node --targetname iqn.2012-10.net.cpd:san.target01 --portal 172.16.201.200 --login
查看核对登录信息iscsiadm -m session -o show
查看磁盘情况fdisk -l
#or
#cat /proc/partitions
格式化磁盘mkfs.ext4 /dev/mapper/san
#格式化大文件
#mkfs.ext4 -T largefile /dev/mapper/san
挂载磁盘mkdir /mnt/san
mount -t ext4 /dev/mapper/san /mnt/san
设置iscsi进程随系统启动、启动自动挂载#1
#查看启动设置
chkconfig --list netfs
#设置启动chkconfig iscsi on
chkconfig iscsid on
#2
#设置自动挂载
vim /etc/fstab
#add
#/dev/sdb1 /var/kvm ext4 _netdev 0 0
查看登录是否正常iscsiadm -m session
netstat -n -p|grep 3260