centos iscsi 配置
首先是服务器的设置:
[root@localhost 桌面]# yum install scsi-target-* -y 安装服务 配置yum的方法太简单了,我就不写了
[root@localhost 桌面]# /etc/init.d/tgtd restart 重启服务
配置tgt
tgt的主配置文件为/etc/tgt/targets.conf,下面我们来设置改文件。
在该文件最后新增以下设置:

<target iqn.2014-07.dev.iscsi-target:iscsidisk>
backing-store /srv/iscsi/disk1.img
backing-store /dev/sdb1
backing-store /dev/vg0/lv1
backing-store /dev/sdd
</target>

4.3 启动iSCSI target
# /etc/init.d/tgtd start
# chkconfig tgtd on
# netstat -tulnp|grep tgt

4.4 查看iSCSI target
# tgt-admin –show


LUN0 是控制器,可以看到各个LUN的大小和磁盘路径。
至此,iSCSI Target 设定完毕。
[root@www yum.repos.d]# tgtadm --lld iscsi --op show --mode target 查看本
机的设置
Target 1: iqn.2010-06.com.yahoo:disk1
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path: None
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 53686 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path: /dev/sdb1
Account information:
ACL information:
ALL
[root@www yum.repos.d]#
以上设置在系统重启之后失效,为了保证开机正常使用需将上面的命令写入
到/etc/rc.d/rc.local让其开机加载,如下:
[root@www 桌面]#cat /etc/rc.d/rc.local
#!/bin/sh
##
This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
mount /dev/cdrom /mnt/ 这是我设置的开机自动挂载光盘
tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2010-06.com.yahoo:disk1
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdb1
tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL 以上三条命令写进去之后会开机自动运行
客户端挂载设置:
yum install -y iscsi-ini*
[root@localhost yum.repos.d]# man iscsiadm 查看命令帮助,参数可以在帮助
里面找到,这样不用死记硬背那些无聊的命令参数
[root@localhost yum.repos.d]# iscsiadm -m discovery -t sendtargets -p
192.168.1.123 –discover 查看服务器的共享,名字和IP记得指向服务器
192.168.1.123:3260,1 iqn.2010-06.com.yahoo:disk1
[root@localhost yum.repos.d]#iscsiadm --mode node --targetname iqn.2010-
06.com.yahoo:disk1 --portal 192.168.1.123:3260 --login 在客户端登陆服务器
的共享,名字和IP地址需要自己手动指向服务器
[root@www 桌面]# fdisk -l 登陆之后查看自己的盘符
[root@www 桌面]# fdisk /dev/sdc 创建建立分区
[root@www 桌面]# mkfs.ext4 /dev/sdc1 格式化分区
[root@www 桌面]# mount /dev/sdc1 /iscsi/ 挂载分区到本机的文件夹
[root@localhost 桌面]# blkid 查看blkid,设置开机挂载
[root@www 桌面]# vim /etc/fstab 编辑开机文件
UUID="08b688b2-888f-4523-b936-dd4fcc443309" /iscsi ext4
defaults,_netdev 0 0
以下是客户端卸载过程:
[root@www /]# umount /iscsi/ 选卸载挂载
[root@localhost yum.repos.d]# iscsiadm -m node -T iqn.2010-
06.com.yahoo:disk1 -p 192.168.1.123:3260 –u 然后注销登陆,注销之后重启服务会自动登陆
Logging out of session [sid: 1, target: iqn.2010-06.com.yahoo:disk1, portal:192.168.1.123,3260]
Logout of [sid: 1, target: iqn.2010-06.com.yahoo:disk1, portal:192.168.1.123,3260] successful.
[root@www /]# iscsiadm -m node -o delete -T iqn.1013-06:disk1 -p
192.168.1.123:3260 -o delete可以将其彻底删除,这样就完全干净的删除了!如果不删除会在服务器留下进程从而影响性能,所以在真是环境下不用的时候一定要记得删除!
http://blog.csdn.net/liukuan73/article/details/46803201
centos iscsi 配置的更多相关文章
- Centos网络配置
网上搜索:centos网络配置的方法,主要包括dns.网关.IP地址,主要是配置resolv.conf\network\ifcfg-eth0这些网络配置文件. 稍后我会就centos7的网络配置进行实 ...
- 阿里云服务器Linux CentOS安装配置(零)目录
阿里云服务器Linux CentOS安装配置(零)目录 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 阿里云服务器Linux CentOS安装配置(二)yum安装svn 阿里云服 ...
- 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署
阿里云服务器Linux CentOS安装配置(九)shell编译.打包.部署 1.查询当前目录以及子目录下所有的java文件,并显示查询结果 find . -name *.java -type f - ...
- 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定
阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...
- 阿里云服务器Linux CentOS安装配置(七)域名解析
阿里云服务器Linux CentOS安装配置(七)域名解析 1.购买域名 登录阿里云,左侧菜单点击[域名],然后[域名注册],完成域名购买.(一般首年45元) 2.添加域名解析 在域名列表里点击你的域 ...
- 阿里云服务器Linux CentOS安装配置(六)resin多端口配置、安装、部署
阿里云服务器Linux CentOS安装配置(六)resin多端口配置.安装.部署 1.下载resin包 http://125.39.66.162/files/2183000003E08525/cau ...
- 阿里云服务器Linux CentOS安装配置(五)jetty配置、部署
阿里云服务器Linux CentOS安装配置(五)jetty配置.部署 1.官网下载jetty:wget http://repo1.maven.org/maven2/org/eclipse/jetty ...
- 阿里云服务器Linux CentOS安装配置(四)yum安装tomcat
阿里云服务器Linux CentOS安装配置(四)yum安装tomcat 1.yum -y install tomcat 执行命令后,会帮你把jdk也安装好 2.tomcat安装目录:/var/li ...
- 阿里云服务器Linux CentOS安装配置(三)yum安装mysql
阿里云服务器Linux CentOS安装配置(三)yum安装mysql 1.执行yum安装mysql命令:yum -y install mysql-server mysql-devel 2.启动mys ...
随机推荐
- c/c++基本数据类型大小
各个类型的变量长度由编译器来决定(实际上与操作系统位数和编译器都有关)使用时可用sizeof()得到,当前主流编译器一般是32位或64位. 类型 32位 64位 char 1 1 short int ...
- hdu 1956(混合图的欧拉回路)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1956 思路:先将无向边定向,比如1<->3,可以定它的方向为1->3,1的出度++, ...
- weex - 创建项目
初始化 请确保你已经安装了 Node.js,然后全局安装 weex-toolkit. npm install weex-toolkit -g 这条命令会向你命令行环境中注册一个 weex 命令.你可以 ...
- Failed to load the JNI shared library jvm.dl
. 原因1:该目录下jvm.dll不存在 2 解决办法:重新安装jdk或者jre并配置好环境变量.copy一个jvm.dll放在该目录下 3 原因2:eclipse的版本与jdk或者jre版本不一致 ...
- dict字典使用方法
keys(). values() .items()方法 1.返回格式 dict_keys. dict_values 和 dict_items 2.常用于循环.迭代 for key in dict_te ...
- SharePoint服务器端对象模型 之 访问网站和列表数据(Part 2)
(二)列表(SPList) 列表是SharePoint中最为重要的数据容器,我们一般保存在SharePoint中的所有数据,都是保存在列表中(文档库也是一种列表),因此列表对象在SharePoint的 ...
- MVC5学习系列
前言 嗷~小弟我又出现了~咳咳..嚎过头了, 先说一说为什么写这个吧,~首先肯定是我自己需要学(废话 - -,)//,之前也写过MVC4的项目,嗯..但是仅限于使用并没有很深入的每个模块去了解, 这段 ...
- ssm框架整合-过程总结(第三次周总结)
本周主要是完成前端界面和后端的整合. 犹豫前后端的工作完成程度不一致,只实现了部分整合. 登录界面. 可能自己最近没有把重心放在短学期的项目上,导致我们工作的总体进度都要比别慢. 虽然我们只是三个人的 ...
- 作为一名合格的JAVA程序员需要点亮那些技能树?
以下是出现次数超过100的一些技能,大家可以做一个参考. Spring 299 MySQL 290 JavaScript 216Linux 165J2EE 151设计模式 148Struts2 138 ...
- Testlink安装访问提示“应用程序DEFAULT WEB SITE”中的服务器错误
错误摘要:HTTP错误403.14 - ForbiddenWeb服务器被配置为不列出此目录的内容.