基于iscsi存储服务的搭建
2011-12-20 14:58
381 查看
创建新的分区:
[root@localhost /]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 13054.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-13054, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-13054, default 13054):
Using default value 13054
Command (m for help):
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@localhost /]# fdisk -l
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 26108 209608087+ 8e Linux LVM
Disk /dev/sdb: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 13054 104856223+ 83 Linux
2.搭建iscsi服务器
[root@localhost /]# yum -y install scsi-target-utils #安装软件包
开启服务
[root@localhost /]# /etc/init.d/tgtd start # 使用3260端口
Starting SCSI target daemon: Starting target framework daemon
c
[root@localhost /]# chkconfig tgtd on
详细信息可以man 一下 man tgtadm
下面创建一个存储(server)
# Create a target
tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2007-03:virtual-dvd:'hostname'
# Create the SMC device and give it a nice name
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 --backing-store /dev/sdb1
# Allow ALL initiators to connect to this target
tgtadm --lld iscsi --mode target --op bind --tid 1 --initiator-address ALL
# Show all our good work.
tgtadm --lld iscsi --mode target --op show
NOTE : 将上述需要写到rc.local文件中,开机自启动
挂载一个存储(client)
[root@it ~]# yum -y install iscsi-initiator-utils
可以man 一下 man iscsiadm
Discover targets at a given IP address:
iscsiadm --mode discoverydb --type sendtargets --portal 192.168.1.10 --discover
Login, must use a node record id found by the discovery:
iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260 --login
Logout:
iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260 --logout
List node records:
iscsiadm --mode node
Display all data for a given node record:
iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260
下面继续我的实例:
[root@it ~]# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.7.116 --discover
192.168.7.116:3260,1 iqn.2007-03:virtual-dvd:hostname
[root@it ~]# iscsiadm --mode node --targetname iqn.2007-03:virtual-dvd:hostname --portal 192.168.7.116:3260 --login
Logging in to [iface: default, target: iqn.2007-03:virtual-dvd:hostname, portal: 192.168.7.116,3260]
Login to [iface: default, target: iqn.2007-03:virtual-dvd:hostname, portal: 192.168.7.116,3260] successful.
[root@it ~]# iscsiadm --mode node
192.168.7.116:3260,1 iqn.2007-03:virtual-dvd:hostname
[root@it ~]# fdisk -l
Disk /dev/sdc: 107.3 GB, 107372772864 bytes
255 heads, 63 sectors/track, 13053 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
多出来一个100G的硬盘 , 这个就是之前挂载过来的那一快
之后进行格式化,挂载就可以了
本文出自 “Create One Eternal Love” 博客,转载请与作者联系!
[root@localhost /]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 13054.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-13054, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-13054, default 13054):
Using default value 13054
Command (m for help):
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@localhost /]# fdisk -l
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 26108 209608087+ 8e Linux LVM
Disk /dev/sdb: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 13054 104856223+ 83 Linux
2.搭建iscsi服务器
[root@localhost /]# yum -y install scsi-target-utils #安装软件包
开启服务
[root@localhost /]# /etc/init.d/tgtd start # 使用3260端口
Starting SCSI target daemon: Starting target framework daemon
c
[root@localhost /]# chkconfig tgtd on
详细信息可以man 一下 man tgtadm
下面创建一个存储(server)
# Create a target
tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2007-03:virtual-dvd:'hostname'
# Create the SMC device and give it a nice name
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 --backing-store /dev/sdb1
# Allow ALL initiators to connect to this target
tgtadm --lld iscsi --mode target --op bind --tid 1 --initiator-address ALL
# Show all our good work.
tgtadm --lld iscsi --mode target --op show
NOTE : 将上述需要写到rc.local文件中,开机自启动
挂载一个存储(client)
[root@it ~]# yum -y install iscsi-initiator-utils
可以man 一下 man iscsiadm
Discover targets at a given IP address:
iscsiadm --mode discoverydb --type sendtargets --portal 192.168.1.10 --discover
Login, must use a node record id found by the discovery:
iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260 --login
Logout:
iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260 --logout
List node records:
iscsiadm --mode node
Display all data for a given node record:
iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260
下面继续我的实例:
[root@it ~]# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.7.116 --discover
192.168.7.116:3260,1 iqn.2007-03:virtual-dvd:hostname
[root@it ~]# iscsiadm --mode node --targetname iqn.2007-03:virtual-dvd:hostname --portal 192.168.7.116:3260 --login
Logging in to [iface: default, target: iqn.2007-03:virtual-dvd:hostname, portal: 192.168.7.116,3260]
Login to [iface: default, target: iqn.2007-03:virtual-dvd:hostname, portal: 192.168.7.116,3260] successful.
[root@it ~]# iscsiadm --mode node
192.168.7.116:3260,1 iqn.2007-03:virtual-dvd:hostname
[root@it ~]# fdisk -l
Disk /dev/sdc: 107.3 GB, 107372772864 bytes
255 heads, 63 sectors/track, 13053 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
多出来一个100G的硬盘 , 这个就是之前挂载过来的那一快
之后进行格式化,挂载就可以了
本文出自 “Create One Eternal Love” 博客,转载请与作者联系!
相关文章推荐
- 秦波|如何基于MySQL及Redis搭建统一的kv存储服务
- 基于AWS S3协议搭建个人云存储服务
- 搭建基于IP SAN的iSCSI存储系统
- 搭建基于 HDFS 碎片文件存储服务
- 用FreeBSD10搭建基于ZFS的iSCSI服务
- Linux的iSCSI共享存储服务搭建
- 基于RHCS+iSCSI+CLVM实现Web服务的共享存储集群架构
- 用FreeBSD10搭建基于ZFS的iSCSI服务
- 搭建基于IP SAN 的 iscsi 存储系统
- 基于RHCS+ISCSI+CLVM实现web服务的共享存储集群架构
- 基于RHCS+ISCSI+CLVM实现web服务的共享存储集群架构
- linux运维进阶-基于RHCS+iSCSI+CLVM实现Web服务的共享存储集群架构
- linux搭建gfs系统 iscsi+GFS 实现网络存储
- 基于SpringMVC下的Rest服务框架搭建【1、集成Swagger】
- 【原】用PHP搭建基于swoole扩展的socket服务(附PHP扩展的安装步骤及Linux/shell在线手册)
- Centos7系列(八)ISCSI网络存储服务
- CentOS下搭建简易iSCSI服务
- 基于CentOS6.5进行IPA服务的搭建――服务端搭建及配置
- 基于lvs的DR模型搭建高可用的web服务,并部署wordpress,(附有脚本实现健康状态检测的代码) 推荐
- 虚拟化基础架构之使用openfiler搭建iSCSI网络共享存储(IPSAN)