字号:    

集群实例:配置ISCSI客户端(LINUX)

集群实例:配置ISCSI客户端(LINUX)

[root@linux ~]# rpm ivh iscsi-initiator-utils-6.2.0.742-0.5.el5.i386.rpm

运行此命令后,会生成一个目录/etc/iscsi,

Initiatorname.iscsi和

[root@linux ~]# cd /etc/init.d

[root@linux ~]# ./iscsi start

[root@linux ~]#iscsiadm --mode discovery --type sendtargets --portal 192.168.1.221

[root@linux ~]# iscsiadm --mode node

显示结果与在7612i串口 iscsi managementiscsi node

[root@linux ~]#iscsiadm --mode node --targetname targetname --portal 192.168.1.221:3260 --login

    其中targetname即是步骤4

(注:3,4,5实施中是在/etc/iscsi下运行,是否可以在别的路径执行,可自行测试以上3个命令格式是从man iscsiadm

经过以上几步,fdisk l就可以看到所挂接分区了,为确保重启后也能看到,再修改一下/etc/iscsi/iscsid.conf,将第5步的命令iscsiadm --mode node --targetname targetname --portal 192.168.1.221:3260 --login

[root@linux ~]# vi /etc/iscsi/iscsid.conf

iscsiadm --mode node --targetname targetname --portal 192.168.1.221:3260 login

其实这个文件大多数内容处于被注释状态,该命令添加位置应该影响不大.然后重启电脑后直接fdisk l 依然可以看到所挂接的分区至此iscsi所有操作完成,但挂载的分区不是linux所识别,必须使用FDISK

fdisk是各种Linux发行版本中最常用的分区工具,是被定义为Expert级别的分区工具我们可以通过fdisk来分区使用iscsi设备它还包括一个二级选单,首先输入命令,然后出现问答式界面,用户通过在这个界面中输入命令参数来操作fdisk

使用n命令创建一个分区,会出现选择主分区(p primary partition)还是扩展分区(l logical)的提示,通常选用主分区然后按照提示输入分区号(Partion number(1-4):)新分区起始的磁盘块数(First Cylinder)和分区的大小,可以是以MB为单位的数字(Last cylindet or +siza or +sizeM or +sizeK

[root@linux ~]#fdisk /dev/sdb

Disk /dev/sdb:255 heads, 63 sectors, 4427 cylinders

Device Boot    Start       End    Blocks   Id  System

Last cylinder or +size or +sizeM or +sizeK (1-4427, default 4427):

WARNING:If you have created or modified any DOS 6.x

partitions, please see the fdisk manual page for additional

[root@linux ~]

The number of cylinders for this disk is set to 4427.

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

Disk /dev/sdb:255 heads, 63 sectors, 4427 cylinders

Device Boot    Start   End    Blocks   Id  System

/dev/sdb1             1      4427  35559846   83  Linux

[root@localhost ~]# mkfs -t ext3 /dev/sdb1

Filesystem label=OS type: Linux

214761472 inodes, 429495759 blocks

21474787 blocks (5.00%) reserved for the super user

32768 blocks per group, 32768 fragments per group

Superblock backups stored on blocks:

            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

            4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,

            102400000, 214990848

Writing inode tables: done                           

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

文件系统必须有一个挂载点,它只是一个空的目录,新文件系统在这里与系统目录树相连 Linux服务器已经连接到 iSCSI 储存设备, 并且如同Linux 本机上面的一个 SCSI 硬盘一样

假设iSCSI 主机挂载到 /cluster/raid

mkdir /cluster/raid

[root@linux ~]# mount  /dev/sda1 /cluster/raid

Filesystem       1K-blocks   Used Available  Use%  Mounted on

/dev/hda1        10080488  2950408   6618012   31% /

tmpfs   5036316         81172     4699312   0% /dev/shm

/dev/sda1     1914788196  27040372 1790482212 2% /cluster/raid

在机器重新启动后自动加载分区,你必须在/etc/fstab中加入相应分区,但分区类型必须市"_netdev".例如加载的分区

[root@linux ~]# vi /etc/fstab

/dev/sdb1   /cluster/raid   ext3    ­_netdev     0   0

/dev/sdc1   /data/sdc1   ext3    _netdev     0  0

/dev/sdd1  /data/sdd1      ext3    _netdev     0 0

文件系统              容量已用可用已用%     

/dev/sda1              64G  5.6G   55G  10% /

tmpfs                 1.7G    0  1.7G   0% /dev/shm

/dev/sdb1             1.6T  197M  1.5T   1% /data/sdb1

/dev/sdc1             1.6T  197M  1.5T   1% /data/sdc1









引文来源  集群实例:配置ISCSI客户端(LINUX) - 集群技术

----------------------------
一键转贴,快速捕捉生活精彩,赢每周好礼!查看活动首页>>

分类:默认分类
?次阅读
 2008-07-03 15:44