Setting Up iSCSI Filesystems
Posted by Kevin Stange, Last modified by Kevin Stange on 24 February 2012 03:23 PM
This document describes how to set up a new iSCSI mount point on a Linux system. These directions will assume you are running CentOS 5 or 6.
Note: Replace any text in angle brackets (including the brackets) with the value provided or determined earlier in the procedure. For example, you would replace "<TARGET NAME>" with the target name provided by support when your mount point is set up.
Prior to deployment, you need to identify the Initiator Name setting for any systems that will use the SAN. Run the following to get the correct value:
Provide the result of the command to support, which will allow us to complete the configuration. Once the volume is ready, you'll be given the relevant connection information to use in the following section. A connection to our Internal Network is required for SAN access, so make sure you have arranged for access on any systems you wish to mount your volume to.
Configure the iSCSI service to log into the SAN
You can check for existing iSCSI sessions by running the following command:
If you are adding a new type of mount (SAN vs SATA) or have not set up any iSCSI mounts before, run these commands:
Enable the iscsi services and start them:
If the server is already configured with a connection for the specific mount type, then all you need to do is rescan to identify new devices.
At this point you should be able to view the disk information. The best utility for this is "lsscsi" or you can just browse the output of "dmesg"
From here, note the device node to be used for partitioning. It would likely be something like /dev/sdb.
Set Up Partitioning
In order to avoid the risk of the device node changing names and to allow the filesystem to be enlarged if desired, LVM is recommended. It's easy to set this up. GROUP NAME and VOLUME NAME can be replaced with any name you want to use. If you're not sure, just use "san" as the GROUP NAME, and "0" as the VOLUME NAME.
If only one volume is desired, then:
At this point your device will be available at:
If you don't want to use LVM, then you'll can either format the whole device or partition it with parted (recommended).
If you do this, your partition would become /dev/<DEV NAME>1. If you used LVM, remember the /dev/mapper/ location and use it below.
Now, format your partition. In most cases, ext4 is a good choice:
Add the mount point to the /etc/fstab file. "_netdev" marks the filesystem on RHEL systems to be unmounted before the network is deactivated on shutdown.
Finally, mount it:
Your new iSCSI filesystem should be ready to use! If you run into any problems, please feel free to contact support for assistance.