Site icon CentLinux

How to configure Openfiler iSCSI Target

Share on Social Media

Learn how to configure Openfiler iSCSI Target with this comprehensive guide. Enhance your network storage capabilities by setting up Openfiler for efficient iSCSI storage management. #centlinux #linux #openfiler

What is Openfiler?

Openfiler is Linux based operating system forked from rPath Linux distribution. Openfiler provides file-based Network Attached Storage (NAS) and block-based Storage Area Network (SAN).  All common network protocols like NFS, SMB/CIFS, HTTP/WebDAV, FTP and iSCSI (initiator and target) has been supported by Openfiler. It is a free software, licensed under the GNU GPL v2.

What is iSCSI?

iSCSI is an acronym for Internet Small Computer Systems Interface. iSCSI is an IP-based storage networking standard for linking data storage facilities. By carrying SCSI commands over IP networks, iSCSI is used to facilitate data transfers over intranets and to manage storage over long distances. iSCSI can be used to transmit data over Local Area Networks (LAN), Wide Area Networks (WAN), or the Internet and can enable location-independent data storage and retrieval.

The iSCSI  protocol allows clients (called Initiators) to send iSCSI commands to iSCSI storage devices (called Targets) on remote servers. It is a Storage Area Network (SAN) protocol, allowing organizations to consolidate storage into data center storage arrays while providing hosts with the illusion of locally attached disks. Unlike traditional Fibre Channel, which usually requires dedicated cabling, iSCSI can be run over long distances using existing network infrastructure.

Recommended Online Training: Learn Bash Shell in Linux for Beginners

Problem Statement

Although, Openfiler is a good choice for test environments, but it isn’t resilient enough, for use in production environments, as compare to hardware storage arrays. Hardware storages are quite expensive, however there are a few medium size storage arrays are available in market that are good for small size institutions, one of them is Synology 2 bay NAS DiskStation DS218+ (Diskless) (PAID LINK).

In this article, we will configure an iSCSI Target using Openfiler and then mount it on a iSCSI Initiator (CentOS) server.

System Specification

Here, we will use the same virtual machine that we have configured during our previous post Installation of Openfiler Appliance.

CPU:3.4 Ghz (1 core)
Memory:1 GB
Storage:80 GB

Configure Openfiler iScsi Target

Openfiler automatically configures a Web Administration GUI during installation and it is running on port 446.

Open Web Administration GUI in your browser to access the Openfiler Admin Console. Browser may display a security warning, because the Openfiler Web UI uses HTTPS protocol and presenting a self-signed SSL certificate. It doesn’t matter, just add this URL to browser’s exception list and continue.

Openfiler Login

Login as openfiler administrator user i.e. openfiler, default password is password. The password can easily be changed using passwd command via Linux shell.

Configure Openfiler 1
Configure Openfiler 2

To check the available storage, click on Volumes in top navigation bar.

Configure Openfiler 3

Click on Block Devices in the right sidebar.

Configure Openfiler 4

Click on /dev/sda at edit disk column.

Configure Openfiler 5

You can see that the 88% storage is free in device /dev/sda. So, we can utilize it for our iScsi Target.

First of all we need to create a Physical Volume

To do this, scroll down to Create a partition in /dev/sda section and add a Physical Volume as follows.

Configure Openfiler 6

By default, it gives you the maximum cylinders to be used by new volume, but you can change it according to your need.

Click on Create.

Configure Openfiler 7

Once the Physical Volume is created, it will be displayed in the above partitions list. In my case, it is added as /dev/sda4.

Now, its time to add a Volume Group. To do this, click on Volume Group on the right sidebar.

Configure Openfiler 8

Provide a VG (Volume Group) Name, select a PV (Physical Volume) and click on Add volume group.

Configure Openfiler 9

Click on Add Volume to Add a Logical Volume.

Configure Openfiler 10

Add a Logical Volume as follows:

Configure Openfiler 11

Click on Create to add a Logical Volume.

Configure Openfiler 12

Now add network access configuration. To do this click on the System at the top navigation bar, and add a network access configuration as follows:

Configure Openfiler 13

Enable the iScsi Target, it is available at the Services page.

Configure Openfiler 14

Finally, go to the Volumes page and add an iScsi Target. Click on iScsi Targets at the right sidebar.

Configure Openfiler 15

Click on Add to add an iSCSI Target. Once added, click on LUN Mapping.

Configure Openfiler 16

Go on with the default settings and click on Map.

Click on the Network ACL, and allow the Network Access Configuration that we have created above.

Configure Openfiler 17

Click on update.

Our iScsi Target has been configured successfully.

Configuring iScsi Initiator on CentOS

Connect to another CentOS machine and configure it as iScsi Initiator.

To configure this machine as iSCSI Initiator, we require commands provided in iscsi-initiator-utils package. Therefore, install it using yum command.

# yum install iscsi-initiator-utils 

Discover iSCSI Target using  iscsiadm command.

# 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

Logging into iScsi Target using iscsiadm command.

# 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.

Use the fdisk to check that the available disks.

# 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

You can notice the /dev/sdb is available now as a directly attached storage.

Use fdisk to create partitions on /dev/sdb.

# 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.

Create filesystem on partition /dev/sdb1 using mke2fs command.

# 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 the partition /dev/sdb1 to /u01 using mount command.

# mkdir /u01 
# mount /dev/sdb1 /u01

Our iSCSI partition has been mounted and ready to use.

If you are new to Linux and facing difficulty in working at Linux Bash prompt. We recommend that, you should read The Linux Command Line, 2nd Edition: A Complete Introduction by William Shotts.

Final Thoughts

Configure Openfiler as an iSCSI Target is an effective way to enhance your network storage capabilities. By following this guide, you can set up Openfiler for efficient iSCSI storage management and improve your data storage infrastructure.

If you need further assistance or prefer professional help with the configuration, I’m here to assist! Check out my Fiverr service for expert support in setting up Openfiler iSCSI Target and other server-related tasks.

Exit mobile version