链接:http://www.eygle.com/archives/2005/11/netapp_linux_iscsi_config_stepbystep.html
Redhat Linux从AS3 update 4开始集成iscsi-initiator。
[root@dell2650 etc]# cat /etc/redhat-release Red Hat Enterprise Linux AS release 3 (Taroon Update 4) [root@dell2650 etc]# rpm -qa|grep iscsi iscsi-initiator-utils-3.6.2-4 |
在NETAPP上可以通过如下步骤分配iSCSI LUN
在菜单Luns部分,选择Add:
设置好相应的参数增加即可。
如果一切正常,即可显示成功:
添加成功后可以在如下界面查看:
此时可以在管理主机上启动/重新启动iscsi进程以识别增加的设备:
[root@dell2650 dev]# /etc/init.d/iscsi stop Stopping iSCSI: iscsid[ OK ] [root@dell2650 dev]# /etc/init.d/iscsi start Starting iSCSI: iscsi iscsid[ OK ] |
我们可以通过dmesg获得硬件信息:
iSCSI: 3.6.1 (22-Sep-2004) built for Linux 2.4.21-27.ELsmp iSCSI: will translate deferred sense to current sense on disk command responses iSCSI: control device major number 254 iSCSI: allocating task cache iscsi_0000729382 with reaping disabled iSCSI: detected HBA f6aed100, host #2 scsi2 : iSCSI 3.6.1 (22-Sep-2004) iSCSI: bus 0 target 0 = iqn.1992-08.com.netapp:sn.84192734 iSCSI: bus 0 target 0 portal 0 = address 172.16.35.228 port 3260 group 1 iSCSI: bus 0 target 0 trying to establish session c3ae8000 to portal 0, address 172.16.35.228 port 3260 group 1 iSCSI: bus 0 target 0 established session c3ae8000 #1, portal 0, address 172.16.35.228 port 3260 group 1 scsi singledevice 2 0 0 1 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 Attached scsi disk sdb at scsi2, channel 0, id 0, lun 1 iSCSI: session c3ae8000 recv_cmd f693aa00, cdb 0x0, status 0x2, response 0x0, senselen 18, key 06, ASC/ASCQ 29/00, itt 3 task f6906f74 to (2 0 0 1), iqn.1992-08.com.netapp:sn.84192734 iSCSI: Sense f0000600 0000000a 00000000 29000000 0000 SCSI device sdb: 20971520 512-byte hdwr sectors (10737 MB) sdb: unknown partition table |
从这里可以看到其设备符为:sdb,我们此时就可以向操作普通硬盘一样操作iSCISI硬盘了.
以下是简单的分区过程:
[root@dell2650 etc]# 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 20480. 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): p Disk /dev/sdb: 21.4 GB, 21474836480 bytes 64 heads, 32 sectors/track, 20480 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes 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-20480, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-20480, default 20480): +4096M Command (m for help): p Disk /dev/sdb: 21.4 GB, 21474836480 bytes 64 heads, 32 sectors/track, 20480 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 3907 4000752 83 Linux Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (3908-20480, default 3908): Using default value 3908 Last cylinder or +size or +sizeM or +sizeK (3908-20480, default 20480): Using default value 20480 Command (m for help): p Disk /dev/sdb: 21.4 GB, 21474836480 bytes 64 heads, 32 sectors/track, 20480 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 3907 4000752 83 Linux /dev/sdb2 3908 20480 16970752 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@dell2650 etc]# cd / [root@dell2650 /]# mkdir data1 [root@dell2650 /]# mkfs /dev/sdb1 mke2fs 1.32 (09-Nov-2002) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 500960 inodes, 1000188 blocks 50009 blocks (5.00%) reserved for the super user First data block=0 31 block groups 32768 blocks per group, 32768 fragments per group 16160 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Writing inode tables: done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 29 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@dell2650 /]# mount /dev/sdb1 /data1 [root@dell2650 /]# df -k /data1 Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdb1 3937820 20 3737764 1% /data1 [root@dell2650 /]# |