标签:
# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xe714b1f2. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sdb: 85.9 GB, 85899345920 bytes 255 heads, 63 sectors/track, 10443 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xe714b1f2 Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-10443, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-10443, default 10443): +20G Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (2613-10443, default 2613): Using default value 2613 Last cylinder, +cylinders or +size{K,M,G} (2613-10443, default 10443): +30G Command (m for help): p Disk /dev/sdb: 85.9 GB, 85899345920 bytes 255 heads, 63 sectors/track, 10443 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xe714b1f2 Device Boot Start End Blocks Id System /dev/sdb1 1 2612 20980858+ 83 Linux /dev/sdb2 2613 6529 31463302+ 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
# partx -a /dev/sdb BLKPG: Device or resource busy error adding partition 1 BLKPG: Device or resource busy error adding partition 2 # cat /proc/partitions major minor #blocks name 8 0 125829120 sda 8 1 512000 sda1 8 2 125316096 sda2 8 16 83886080 sdb 8 17 20980858 sdb1 8 18 31463302 sdb2 253 0 4096000 dm-0 253 1 20480000 dm-1 253 2 25600000 dm-2 253 3 30720000 dm-3
# yum install -y iscsi-initiator-utils # echo "InitiatorName=`iscsi-iname -p iqn.2016-04.com.chinasoft`" > /etc/iscsi/initiatorname.iscsi # echo "InitiatorAlias=initiator1" >> /etc/iscsi/initiatorname.iscsi # cat /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2016-04.com.chinasoft:59b0936b38a3 InitiatorAlias=initiator1
# service iscsi start # chkconfig iscsi on # chkconfig --list iscsi iscsi 0:off1:off 2:on3:on 4:on5:on 6:off
iscsiadm -m discovery [ -d debug_level ] [ -P printlevel ] [ -I iface -t type -p ip:port [ -l ] ] iscsiadm -m node [ -d debug_level ] [ -P printlevel ] [ -L all,manual,automatic ] [ -U all,manual,automatic ] [ [ -T tar-getname -p ip:port -I iface ] [ -l | -u | -R | -s] ] [ [ -o operation ] -d, --debug=debug_level 显示debug信息,级别为0-8; -l, --login -t, --type=type 这里可以使用的类型为sendtargets(可简写为st)、slp、fw和 isns,此选项仅用于discovery模式,且目前仅支持st、fw和isns;其中st表示允许每个iSCSI target发送一个可用target列表给initiator; -p, --portal=ip[:port] 指定target服务的IP和端口; -m, --mode op 可用的mode有discovery, node, fw, host iface 和 session -T, --targetname=targetname 用于指定target的名字 -u, --logout -o, --op=OPEARTION:指定针对discoverydb数据库的操作,其仅能为new、delete、update、show和nonpersistent其中之一; -I, --interface=[iface]:指定执行操作的iSCSI接口,这些接口定义在/var/lib/iscsi/ifaces中;
# iscsiadm -m discovery -t st -p 192.168.8.42 Starting iscsid: [ OK ] 192.168.8.42:3260,1 iqn.2016-04.com.chinasoft.san:1 # iscsiadm -m node -T iqn.2016-04.com.chinasoft.san:1 -p 192.168.8.42 -l Logging in to [iface: default, target: iqn.2016-04.com.chinasoft.san:1, portal: 192.168.8.42,3260] (multiple) Login to [iface: default, target: iqn.2016-04.com.chinasoft.san:1, portal: 192.168.8.42,3260] successful.
# fdisk /dev/sdc Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xe3266877. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-20489, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-20489, default 20489): +3G Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (3074-20489, default 3074): Using default value 3074 Last cylinder, +cylinders or +size{K,M,G} (3074-20489, default 20489): +2G Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
# partx -a /dev/sdc BLKPG: Device or resource busy error adding partition 1 BLKPG: Device or resource busy error adding partition 2 # cat /proc/partitions major minor #blocks name 8 0 125829120 sda 8 1 512000 sda1 8 2 125316096 sda2 8 16 83886080 sdb 253 0 30720000 dm-0 253 1 4096000 dm-1 253 2 25600000 dm-2 253 3 30720000 dm-3 253 4 10240000 dm-4 8 48 31463302 sdd 8 32 20980858 sdc 8 33 3146736 sdc1 8 34 2098176 sdc2
# mke2fs -t ext4 /dev/sdc1 挂载 # mount /dev/sdc1 /mnt # cd /mnt # ls lost+found # cp /etc/rc.d/rc.sysinit ./ # ls lost+found rc.sysinit # vim rc.sysinit
# tgtadm -L iscsi -o show -m target
至此iscsi服务端target及客户端initiator工具常用配置已讲解完毕
centos 6.5环境利用iscsi搭建SAN网络存储服务及服务端target和客户端initiator配置详解
标签:
原文地址:http://blog.csdn.net/reblue520/article/details/51277712