1、rootwmm # rpm -aq|grep scsi-initial-utilsrootwmm # yum -y install scsi-initial-utils采用文件镜像作为iscsi-targetrootwmm # dd if=/dev/zero of=/srv/iscsi/disk1.img bs=1M count=500记录了500+0 的读入记录了500+0 的写出524288000字节(524 MB)已复制,13.4097 秒,39.1 MB/秒rootwmm # fdisk /dev/sdbWARNING: DOS-compatible mode is deprecate
2、d. Its strongly recommended to switch off the mode (command c) and change display units to sectors (command u).Command (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 1First cylinder (1-2610, default 1): Using default value 1Last cylinder, +cylinders or +si
3、zeK,M,G (1-2610, default 2610): +1000M wqThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.rootwmm # partprobe【更新到内核中】Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (设备或资源忙). As a result, it may not reflect all of your chang
4、es until after reboot.创建LVrootwmm # partproberootwmm # pvcreate /dev/sdb1 Writing physical volume data to disk /dev/sdb1 Physical volume successfully created创建VGrootwmm # vgcreate server /dev/sdb1 Volume group serverrootwmm # lvcreate -L 1G -n iscsi01 server【可以采用500PE】rootwmm # service iptables stop
5、iptables:清除防火墙规则: 确定将链设置为政策 ACCEPT:nat mangle filter 确定正在卸载模块:编辑配置文件:rootwmm # vim /etc/tgt/targets.conf【目标|标准查询|日期|主机名|共享名】backing-store /dev/sdb2【设备一】backing-store /srv/iscsi/disk1.img【镜像名】backing-store /dev/server/iscsi01【设备绿】/target【backing-store:虚拟设备|direct-store:实际设备,如果整个磁盘做位存储就选直接存储】采用虚机存储有三种
6、方式:分区,dd的大磁盘文件,LV。Initiator-address:允许发现的地址Incominguser:允许进入的用户名密码。Write-cache:用于加速的缓存,容易丢失数据。启动服务:rootwmm # /etc/init.d/tgtd start正在启动 SCSI target daemon:tgtadm: invalid requestCommand: tgtadm -C 0 -lld iscsi -op new -mode logicalunit -tid 1 -lun 2 -b /srv/iscsi/disk1.img exited with code: 22.rootw
7、mm # chkconfig tgtd on【开机启动】查看端口是否开启:rootwmm # netstat -tulnp|grep 3260tcp 0 0 0.0.0.0:3260 0.0.0.0:* LISTEN 25605/tgtd tcp 0 0 :3260 :rootwmm # tgt-admin -show【查看一下设备】Target 1: iqn.2012-:wmmdisk System information: Driver: iscsi State: ready I_T nexus information: LUN information: LUN: 0 Type: cont
8、roller SCSI ID: IET 00010000 SCSI SN: beaf10 Size: 0 MB, Block size: Online: Yes Removable media: No Prevent removal: Readonly: Backing store type: null Backing store path: None Backing store flags: disk IET 00010001 beaf11 1053 MB, Block size: 512 rdwr /dev/sdb2 2 IET 00010002 beaf12 1074 MB, Block
9、 size: /dev/server/iscsi02 Account information:ACL information:Linux客户端设置:rootwmm # service iscsid restart停止 iscsid:正在启动 iscsid:rootwmm # chkconfig iscsid on【开机启动】如果是linux客户端,完整的步骤如下:rootwmm # /etc/init.d/iscsi restart停止 iscsi:正在启动 iscsi:rootwmm # chkconfig iscsi on【设置开机自动启动】rootwmm # iscsiadm -m di
10、scovery -t sendtargets -p 127.0.0.1【发现和侦测】127.0.0.1:3260,1 iqn.2012-:rootwmm # iscsiadm -m node【发现节点】rootwmm # fdisk -l【如果你发现有另外的盘,就表示挂载上了啊!格式化,挂载即可,我们可以再一次整合成为VG】rootwmm # pvcreate /dev/sdd,e/dev/sdd/dev/sderootwmm # vgextend server /dev/sdd,e Found duplicate PV 0Q9P5AuDQxwM6SeM817n1xUVjUun1jkv: us
11、ing /dev/sdd not /dev/sdb2 using /dev/sdb2 not /dev/sdd No physical volume label read from /dev/sde successfully extendedrootwmm # vgdisplayrootwmm # lvcreate -L 700 -n wmmdisk server Logical volume wmmdisk createdrootwmm # lvdisplay 格式化:rootwmm # mkfs.ext4 /dev/server/wmmdisk mke2fs 1.41.12 (17-May
12、-2010)文件系统标签=操作系统:Linux块大小=4096 (log=2)分块大小=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks44832 inodes, 179200 blocks8960 blocks (5.00%) reserved for the super user第一个数据块=0Maximum filesystem blocks=1845493766 block groups32768 blocks per group, 32768 fragments per group7472 inodes per groupSuper
13、block backups stored on blocks: 32768, 98304, 163840正在写入inode表: 完成 Creating journal (4096 blocks): 完成Writing superblocks and filesystem accounting information:This filesystem will be automatically checked every 32 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.挂载:rootwmm # mount /dev/server/wmmdisk /mnt/wmmdisk/
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1