[root@rhel5 /]# service iscsi start //启动iSCSI客户端服务。 Setting up iSCSI targets: iscsiadm: No records [ OK ] [root@rhel5 /]# iscsiadm -m discovery -t st -p 192.168.1.249 //搜索NAS服务器上的iSCSI-Targets记录,结果显示已发现一个iSCSI-Targets记录。 192.168.1.249:3260,1 iqn.2006-01.com.openfiler:tsn.0229e3483cdc [root@rhel5 /]# fdisk –l //显示RHEL5系统的磁盘分区情况。 Disk /dev/hda: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 13 104391 83 Linux /dev/hda2 14 1044 8281507+ 8e Linux LVM [root@rhel5 /]# iscsiadm -m node -p 192.168.1.249 --login //登录NAS服务器,与ISCSI-Targets Server建立连接。 Login session [iface: default, target: iqn.2006-01.com.openfiler:tsn.0229e3483cdc, portal: 192.168.1.249,3260] [root@rhel5 /]# fdisk –l //再次显示RHEL5系统的磁盘分区,发现多出一块硬盘,/dev/sda就是Openfiler系统上刚刚划分的LUN。 Disk /dev/hda: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 13 104391 83 Linux /dev/hda2 14 1044 8281507+ 8e Linux LVM Disk /dev/sda: 3154 MB, 3154116608 bytes //多出的磁盘/dev/sda,大小为3G左右。 98 heads, 62 sectors/track, 1013 cylinders Units = cylinders of 6076 * 512 = 3110912 bytes Disk /dev/sda doesn't contain a valid partition table [root@rhel5 /]# fdisk /dev/sda //对/dev/sda磁盘分区。 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. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help): p //显示分区情况,/dev/sda暂无分区信息。 Disk /dev/sda: 3154 MB, 3154116608 bytes 98 heads, 62 sectors/track, 1013 cylinders Units = cylinders of 6076 * 512 = 3110912 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-1013, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-1013, default 1013): Using default value 1013 Command (m for help): w //保存分区信息,并退出。 The partition table has been Calling ioctl() to re-read partition table. Syncing disks. [root@rhel5 /]# partprobe //将新建分区信息写入到内核。 [root@rhel5 /]# mkfs.ext3 /dev/sda1 //创建文件系统,将/dev/sda1分区格式化为ext3。 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 384768 inodes, 769365 blocks 38468 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=788529152 24 block groups 32768 blocks per group, 32768 fragments per group 16032 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 35 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@rhel5 /]# mkdir /media/sda1 //创建挂载点 [root@rhel5 /]# mount /dev/sda1 /media/sda1/ //将新建的分区挂载使用。 [root@rhel5 /]# cd /media/sda1/ [root@rhel5 sda1]# ls //显示/dev/sda1分区信息 lost+found [root@rhel5 sda1]# df -h //查看挂载情况,显示正常挂载 Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 5.8G 2.2G 3.3G 40% / /dev/hda1 99M 20M 75M 21% /boot tmpfs 471M 0 471M 0% /dev/shm 192.168.1.250:/netinstall 450G 294G 133G 69% /mnt /dev/sda1 2.9G 69M 2.7G 3% /media/sda1
|