使用 OpenFiler 配置 iScsi 目标

Openfiler 在安装期间自动配置 Web 管理 GUI,它在端口 446 上运行。

在浏览器中打开 Web 管理 GUI 以访问 Openfiler 管理控制台。
浏览器可能会显示安全警告,因为 Openfiler Web UI 使用 HTTPS 协议并提供自签名 SSL 证书。
没关系,只需将此URL添加到浏览器的例外列表中并继续。

以 openfiler 管理员用户登录,例如:openfiler,默认密码为 password。
可以通过 Linux shell 使用 passwd 命令轻松更改密码。

要检查可用存储空间,请单击顶部导航列中的 Volumes。

单击右侧边列中的块设备。

单击编辑磁盘列中的 /dev/sda。

我们可以看到设备 /dev/sda 中有 88% 的存储空间是免费的。
因此,我们可以将其用于 iScsi 目标。

首先,我们需要创建一个 Physical Volume 。

为此,向下滚动到在 /dev/sda 部分创建一个分区并添加一个物理卷,如下所示。

默认情况下,它为我们提供新卷使用的最大柱面数,但我们可以根据需要更改它。

单击创建。

创建物理卷后,它将显示在上面的分区列表中。
在我的例子中,它被添加为 /dev/sda4.

现在,是时候添加一个 Volume Group 了。
为此,请单击右侧列上的卷组。

提供 VG(卷组)名称,选择 PV(物理卷)并单击添加卷组。

单击添加卷以添加逻辑卷。

添加逻辑卷如下:

单击创建以添加逻辑卷。

现在添加网络访问配置。
为此,请单击顶部导航列中的系统,然后添加如下网络访问配置:

启用 iScsi 目标,它位于服务页面。

最后,转到 Volumes 页面并添加 iScsi Target 。
单击右侧边列中的 iScsi 目标。

单击添加以添加 iSCSI 目标。
添加后,单击 LUN 映射。

继续使用默认设置,然后单击地图。

单击网络 ACL,并允许我们在上面创建的网络访问配置。

点击更新。

我们的 iScsi 目标已成功配置。

之路 on it Road.com

在 CentOS 上配置 iScsi 启动器

连接到另一台 CentOS 机器并将其配置为 iScsi Initiator。

要将这台机器配置为 iSCSI Initiator,我们需要 iscsi-initiator-utils 包中提供的命令。
因此,使用 yum 命令安装它。

[root@appserver ~]# yum install iscsi-initiator-utils

使用 iscsiadm 命令发现 iSCSI 目标。

[root@appserver ~]# iscsiadm --mode discovery --op update --type sendtargets --portal 192.168.79.131 
Starting iscsid:                                           [  OK  ] 
192.168.79.131:3260,1 iqn.2006-01.com.openfiler:tsn.83f292b7b1f4 
[root@appserver ~]#

使用 iscsiadm 命令登录 iScsi Target。

[root@appserver ~]# iscsiadm -m node --targetname "iqn.2006-01.com.openfiler:tsn.83f292b7b1f4" --portal "192.168.79.131:3260" --login 
Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.83f292b7b1f4, portal: 192.168.79.131,3260] (multiple) 
Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.83f292b7b1f4, portal: 192.168.79.131,3260] successful. 
[root@appserver ~]#

使用 fdisk 检查可用磁盘。

[root@appserver ~]# fdisk -l
Disk /dev/sda: 53.7 GB, 53687091200 bytes 
255 heads, 63 sectors/track, 6527 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: 0x000b6ed9
   Device Boot      Start         End      Blocks   Id  System 
/dev/sda1   *           1          64      512000   83  Linux 
Partition 1 does not end on cylinder boundary. 
/dev/sda2              64        6528    51915776   8e  Linux LVM
Disk /dev/mapper/vg_appserver-lv_root: 49.0 GB, 48964304896 bytes 
255 heads, 63 sectors/track, 5952 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: 0x00000000
Disk /dev/mapper/vg_appserver-lv_swap: 4194 MB, 4194304000 bytes 
255 heads, 63 sectors/track, 509 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: 0x00000000
Disk /dev/sdb: 71.7 GB, 71705821184 bytes 
255 heads, 63 sectors/track, 8717 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: 0x00000000
[root@appserver ~]#

我们会注意到 /dev/sdb 现在可用作直接连接的存储。

使用 fdisk 在 /dev/sdb 上创建分区。

[root@appserver ~]# 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 0x9b081c36. 
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): m 
Command action 
   a   toggle a bootable flag 
   b   edit bsd disklabel 
   c   toggle the dos compatibility flag 
   d   delete a partition 
   l   list known partition types 
   m   print this menu 
   n   add a new partition 
   o   create a new empty DOS partition table 
   p   print the partition table 
   q   quit without saving changes 
   s   create a new empty Sun disklabel 
   t   change a partition's system id 
   u   change display/entry units 
   v   verify the partition table 
   w   write table to disk and exit 
   x   extra functionality (experts only)
Command (m for help): n 
Command action 
   e   extended 
   p   primary partition (1-4) 
p 
Partition number (1-4): 1 
First cylinder (1-8717, default 1): 
Using default value 1 
Last cylinder, +cylinders or +size{K,M,G} (1-8717, default 8717): 
Using default value 8717
Command (m for help): p
Disk /dev/sdb: 71.7 GB, 71705821184 bytes 
255 heads, 63 sectors/track, 8717 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: 0x9b081c36
   Device Boot      Start         End      Blocks   Id  System 
/dev/sdb1               1        8717    70019271   83  Linux
Command (m for help): w 
The partition table has been altered!
Calling ioctl() to re-read partition table. 
Syncing disks.

使用 mke2fs 命令在分区 /dev/sdb1 上创建文件系统。

[root@appserver ~]# mke2fs /dev/sdb1 
mke2fs 1.41.12 (17-May-2010) 
Filesystem label= 
OS type: Linux 
Block size=4096 (log=2) 
Fragment size=4096 (log=2) 
Stride=0 blocks, Stripe width=0 blocks 
4382720 inodes, 17504817 blocks 
875240 blocks (5.00%) reserved for the super user 
First data block=0 
Maximum filesystem blocks=4294967296 
535 block groups 
32768 blocks per group, 32768 fragments per group 
8192 inodes per group 
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424
Writing inode tables: done 
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 20 mounts or 
180 days, whichever comes first.  Use tune2fs -c or -i to override.

使用 mount 命令将分区 /dev/sdb1 挂载到 /u01.

[root@appserver ~]# mkdir /u01 
[root@appserver ~]# mount /dev/sdb1 /u01

我们的 iSCSI 分区已安装并可以使用。

在 CentOS 上Openfiler配置 iScsi 目标和启动器

Openfiler 是从 rPath Linux 发行版衍生出来的基于 Linux 的操作系统。

Openfiler 提供基于文件的网络添加存储 (NAS) 和基于块的存储区域网络 (SAN)。
Openfiler 支持所有常见的网络协议,如 NFS、SMB/CIFS、HTTP/WebDAV、FTP 和 iSCSI(发起方和目标方)。
它是一个免费软件,在 GNU GPL v2 下获得许可。

iSCSI 是 Internet 小型计算机系统接口的首字母缩写词。
iSCSI 是一种基于 IP 的存储网络标准,用于连接数据存储设施。
通过在 IP 网络上传送 SCSI 命令,iSCSI 用于促进内部网的数据传输和远距离管理存储。

在本文中,我们将使用 Openfiler 配置 iSCSI Target,然后将其安装在 iSCSI Initiator (CentOS) 服务器上。

日期:2020-09-17 00:10:53 来源:oir作者:oir