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 ...
随机推荐
- iOS --提取本地<通讯录>数据 <1>
#pragma mark - 获取手机所有联系人 - (void)obtainPhoneAllContact { //这个变量用于记录授权是否成功,即用户是否允许我们访问通讯录 ; //声明一个通讯簿 ...
- 【Android 多语言切换简单实例分享】
一.Android多语言切换 Android应用的开发不可能仅仅针对某一个国家或者区域使用,各国间语言文化各不同样,因此一个优秀的APP必须支持多种语言,为了实现这个特性,Android给出了一个解决 ...
- iptables 实际操作 之 规则查询 2
在之前的文章中,我们已经总结过,iptables 为我们预定义了4张表,他们分别是raw 表,mangle表,nat表,filter表,不同的表拥有不同的功能. filter 负责过滤功能,比如允许那 ...
- LeetCode Problem 35:Search Insert Position
描述:Given a sorted array and a target value, return the index if the target is found. If not, return ...
- Cocos2d-x Lua中Sprite精灵类
精灵类是Sprite,它的类图如下图所示. Sprite类图 Sprite类直接继承了Node类,具有Node基本特征.此外,我们还可以看到Sprite类的子类有:PhysicsSprite和Skin ...
- G - Oil Deposits(dfs)
G - Oil Deposits Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u De ...
- Error: unable to connect to node rabbit@10: nodedown 修改hostname后异常
https://blog.csdn.net/witsmakemen/article/details/22651365 [root@d bin]# rabbitmqctl start_appStarti ...
- DumpBinary
stdafx.h #include "targetver.h" #include <stdio.h> #include <tchar.h> #include ...
- ApexSQL Recover 恢复一个被drop的表的数据
没有备份的情况下恢复一个被drop的表的数据 ApexSQL Recover 恢复一个被drop的表的数据 转自:https://solutioncenter.apexsql.com/zh/%E6%B ...
- Java基础—类和对象
基本概念 对象:对象是类的一个实例,有状态和行为.例如,一条狗是一个对象,它的状态有:颜色.名字.品种:行为有:摇尾巴.叫.吃等. 类:类是具有相同属性和方法的一组对象的集合,它为属于该类的所有对象提 ...