Editing
Mounting iSCSI LUNs
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
As much as it would be nice to have it the same across the different OS distributions, it seems there are differences -- some of which are rather annoying. == Pre-requisites == It is assumed that you already have your storage server configured with LUNs (Volumes in the Dell EquaLogic vocabulary) as desired for the application. These instructions assume that no passwords are needed to access the LUNs, but the ID/password stuff is straightforward enough in the config files that it shouldn't be an issue. You will need to install the client software (it's not installed by default, though it is in the basic distributions): * Debian/Ubuntu: open-iscsi * RHEL/CentOS/Fedora: iscsi-initiator-utils There is one change that needs to be made to the iscsi config file '''''/etc/iscsi/iscsi.conf''''': the node startup must be set to automatic (if it isn't already set that way). Search for the '''node.startup''' parameter in the file and set it to 'automatic': node.startup = automatic If passwords are required to access the storage server, add them to the configuration file as well. Restart the service for this to take effect: sudo systemctl restart iscsid == Establishing Sessions == Mounting the LUN on the storage server to the client system is a two-part process. First, you have to establish a session between the client (initiator in iSCSI vocabulary) and the target (server). The first step is to connect to the server to see what LUNs it has available: iscsiadm -m discovery -t st -p <SERVER-IP> This will produce output similar to: 10.2.0.201:3260,1 iqn.2001-05.com.equallogic:0-8a0906-52b816708-021a01fa52261173-shared 10.2.0.201:3260,1 iqn.2001-05.com.equallogic:0-8a0906-85f816708-38832e635165c2b0-files The first part is the server IP and port (should be the same as specified in the command), but the last part of each line is the '''''iqn''''' for the LUN being advertised. The last part of the iqn should be the name of the LUN/volume ... if there is a problem identifying which one, look back at the storage server. Establishing a session for a LUN should be as simple as: iscsiadm -m node -T <iqn from above> -p <SERVER-IP> -l Once this is done (and if you set the node startup to 'automatic' above), it will persist across reboots and you should not have to do this again. == Mounting the LUN == This is where things diverge for different Linux distributions. The differences include the sequence during boot where multiple things have to happen before the mount is successful: # the basic device structure is created # the network devices are created # the network devices are configured and connect to a network # the iscsi subsystem starts and tries to connect to the storage server # the mount process takes the device created by the iscsi session and mounts it Getting these activities to happen in the right order is what gets challenging; the process for doing this under RHEL-style distributions uses systemd and is described [[Systemd mounted iSCSI volumes|here]]. With Debian-based distributions, the process only involves adding an entry to the '''''/etc/fstab''''' file. First, however, you need to create the filesystem and get the needed data for mounting. Get the device assigned to your LUN: ls -l /dev/disk/by-path This will show all your drives -- the one for the LUN will actually contain the iqn for the LUN in the path. Now you make the filesystem (I prefer XFS): sudo apt install -y xfsprogs sudo mkfs.xfs /dev/sdX Now you get the UUID for the filesystem to create the entry in '''''/etc/fstab'''''. Mounting by UUID is safer than using the device name since if you add more iSCSI LUNs or add other disk devices, the device name can change. ls -l /dev/disk/by-uuid Find the UUID for the iSCSI device. Note that this UUID is created by the ''mkfs'' process ... if you rebuild the filesystem, it will have a new UUID. Now you can add a line to '''''/etc/fstab''''': UUID=<uuid from the last step> <mount point> xfs _netdev,auto,defaults 0 0 The ''_netdev'' specifies that the device is network-based and must wait for the network to be up and stable before the mount can succeed. Now you can mount the device or just reboot the system: sudo mkdir <mount point> sudo mount <mount point> Definitely more work than it should have taken ... == Removing the mount == If you ever have to permanently remove the mount, you just reverse the process: sudo umount <mount point> sudo rmdir <mount point> sudo iscsiadm -m node -T <IQN> -p <server-IP> --logout At that point, remove the line from '''''/etc/fstab''''' and you should be good. The data on the LUN is not affected by these actions -- if it is mounted from another system, it will still have everything that was there before. To completely destroy the storage, you will need to delete the volume/LUN and wipe its contents from the storage server itself.
Summary:
Please note that all contributions to WilliamsNet Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
WilliamsNet Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Navigation
Commons
Architecture
How-To
Systems
Hardware
SysAdmin
Kubernetes
OpenSearch
Special
Pages to create
All pages
Recent changes
Random page
Help about MediaWiki
Formatting Help
Tools
What links here
Related changes
Special pages
Page information