Connecting to Storage Systems using iSCSI, NFS, and CIFS (SMB)
Master storage connectivity protocols with our comprehensive guide. Learn iSCSI, NFS, and SMB/CIFS configuration for Windows and Linux environments to optimize your enterprise storage infrastructure.
As enterprises scale their infrastructure, choosing the right storage connectivity protocol becomes critical for performance and security. Each operating system has different methods for utilizing these protocols, and different operating systems will perform differently with each protocol.
For the purpose of this article we are going to focus on two methods of connecting to storage: LUNs and File Shares. In our examples we will be using Open Filer as the storage device, then various Linux and Windows editions to connect to the storage system.
📘 Note: This article covers only the client side of things. You can see our article on Configuring Open Filer if you wish to quickly setup the server side of any of the protocols outlined in this article.
Logical Unit Numbers (LUN) Explained
When considering the use of LUNs there are two main protocols used: Fiber Channel and iSCSI. Understanding the differences between these protocols is crucial for enterprise storage planning.
Fiber Channel Requirements
In order to use Fiber Channel you will need a Fiber Channel Host Bus Adapter (HBA) in your Server, and fiber optic cables running to your storage device which must speak the fiber channel protocol.
iSCSI Advantages
With iSCSI an HBA is optional and runs over normal Ethernet. In most cases it is advisable to have a dedicated network port for your iSCSI traffic, but it does not necessarily require any additional hardware. The reason why you may want to consider adding an iSCSI HBA to the mix is to offload that processing from your servers CPU.
At this point you may ask yourself which will give me better performance, iSCSI or Fiber Channel? The answer is, I have heard good arguments for each protocol; so it is really up to you. I usually use iSCSI because it does not require specialized hardware and I get sufficient performance for what I usually use.
When considering Server Virtualization, both of these protocols are supported on all the server class products, Example: Xenserver, VMWare, and Hyper-V.
Network Shares Explained
There are quite a few protocols for sharing files. In this article I will focus on Network File Systems (NFS) and Server Message Block (SMB) shares.
SMB/CIFS Shares
SMB Shares are also referred to as Common Internet File System (CIFS) shares or Windows Shares. With SMB Shares you specify a resource you want to share on a given server, then the client connects to that resource using something called a Universal Naming Convention (UNC) path.
A UNC path may look something like \\MyServer\ShareName
or \\MyServer\Sharename\myfile
where MyServer is the name of your server, and Sharename is the name of the resource that has been shared and myfile is the name of the file you wish to access off the network share.
NFS Shares
NFS Shares are primarily used in Unix and Linux based operating systems. When working with NFS you mount a remote folder to a local path. For example: if you want to share a folder containing a set of documents with the users are your network, you create something called an NFS Export. Your client machines then mount this exported share to a path such as /home/username/documents
. Then the user can access those documents as if the documents were stored on their machine.
In the context of virtualization, your Virtualization Host server can mount these NFS exports and run virtual machines stored on these NFS Exports. VMWare ESX and Xenserver support NFS Datastores.
Attaching to an iSCSI LUN
A server hosting an iSCSI LUN is known as an iSCSI Target. For a client to connect to the iSCSI Target you need an iSCSI initiator. An iSCSI initiator may be a HBA or some sort of software. Most operating systems do not come with iSCSI initiator software installed. If you are running Windows Vista/Server 2008 or newer this software is already installed.
Windows Vista/7/Server 2008/R2
- Click on the Start menu, Select Control Panel
- Click on Administrative Options
- Click on iSCSI Initiator
- You may be prompted to start the iSCSI Initiator Service, Click Yes to start the Service
Linux
Most Linux distributions do not come with iSCSI initiator software. One piece of software which will allow you to connect is the Open-iSCSI Project.
Installing iSCSI Initiator on Red Hat based Distributions:
yum install iscsi-initiator-utils
Installing iSCSI Initiator on Debian based Distributions:
sudo apt-get install open-iscsi
Authentication
After you have installed your iSCSI initiator, we have to configure it. The first step is to enter your authentication information. If you are not using iSCSI authentication, you can skip this part. This is stored in the /etc/iscsi/iscsid.conf
file.
node.session.auth.username = My_ISCSI_USR_NAME
node.session.auth.password = MyPassword
discovery.sendtargets.auth.username = My_ISCSI_USR_NAME
discovery.sendtargets.auth.password = MyPassword
💡 Tip: In your configuration file you may see a “#” at the beginning of the line. The lines that start with a “#” are considered comments and are not processed as part of the configuration. If your server requires authentication, remove the “#” from the beginning of the line, then enter the appropriate information on each line.
Connecting your LUN
Now that your iSCSI authentication is configured, you can start the service:
/etc/init.d/open-iscsi start
To get the IQN of your server, you can run:
cat /etc/iscsi/initiatorname.iscsi
The iscsiadm utility is used to tell the initiator where to discover the iSCSI LUN:
iscsiadm -m discovery -t sendtargets -p MyServer
You may need to re-start the iSCSI service before the LUN will show up:
/etc/init.d/open-iscsi restart
⚠️ Note: I have had problems where occasionally the LUN does not show up. You can attach the LUN by issuing: iscsiadm -m node --portal "MyServer:3260" -l
Mounting NFS Exports
Windows
Before you can connect to an NFS Share you will need to download the latest Subsystem for UNIX-based applications (SUA) from the Microsoft website.
After you have installed the SUA, mounting the NFS Share via Command Prompt:
mount //MyServer/MyShare <Drive Letter>
Linux
Most Linux Distributions will come with the necessary software to mount an NFS Share. If not, install with:
Debian based:
apt-get install nfs-common
Red Hat based:
yum install nfs-common
Mount the NFS share:
mount -t nfs MyServer:/MyShare /mnt/mymountpoint
To ensure automatic mounting after restart, edit /etc/fstab
and add:
MyServer:/MyShare /mnt/mymountpoint nfs
Connecting to SMB/CIFS Shares
Windows
To map a drive from Command Prompt:
net use K: \\myserver\myshare
To map via GUI:
- Click on the Start menu
- Right click on Computer, select Map network Drive
- Select drive letter and enter UNC path
- Check “Reconnect at login” if desired
Linux
Linux does not natively support SMB Shares, you will need to install SMB Client software.
Debian based:
apt-get install smbfs smbclient
Red Hat based:
yum install samba-client
Mount the SMB Share:
mount -t cifs //myserver/myshare -o username=<user>,password=<pass> /mnt/mymountpoint
To automatically mount on restart, add to /etc/fstab
:
//myserver/myshare /mnt/mymountpoint cifs auto,user,username=<yourusername>,workgroup=<yourworkgroup>,password=<yourpassword>,uid=500,gid=500,file_mode=0777,dir_mode=0777,rw 0 0
Elevate Your IT Efficiency with Expert Solutions
Transform Your Technology, Propel Your Business
Unlock advanced technology solutions tailored to your business needs. At InventiveHQ, we combine industry expertise with innovative practices to enhance your cybersecurity, streamline your IT operations, and leverage cloud technologies for optimal efficiency and growth.