Warning Livedoc is no longer being updated and will be deprecated shortly. Please refer to https://documentation.tjhsst.edu.

SAN/iSCSI Administration

From Livedoc - The Documentation Repository
Revision as of 12:38, 26 December 2016 by 2019okulkarn (talk | contribs)
Jump to: navigation, search

This page contains administration guidelines and commands for iSCSI exports on the CSL SAN.

Adding an iSCSI LUN

This is used to add a new iSCSI LUN to the SAN.

ZVOL creation

All of the iSCSI exports on the SAN are currently backed by ZVOL block devices. ZVOLs provide much better performance than using raw datafiles over top of a normal filesystem and are easily expanded and managed using ZFS.

For ease of management, related ZVOLs are typically grouped underneath a ZFS filesystem. First we create the filesystem, then we create each of the ZVOLs beneath it. For most VMs, you will need two ZVOLs; one for the root partition and one for swap.

 zfs create apocalypse/vms/<vm>
 zfs create -V 15G apocalypse/vms/<vm>/root
 zfs create -V 1G apocalypse/vms/<vm>/swap

iSCSI Exports

iSCSI Exports are currently done using the LIO iSCSI Target managed through Pacemaker. Therefore, we need to add the new LUNs to Pacemaker which will handle bringing them online on the appropriate host.

First you need to generate a unique value for each LUN to use as an SCSI ID. We use the first half of the md5 hash of the LUN's name as a reliably unique value.

 echo -n apocalypse-<vm>-root | md5sum | head -c 16
 echo -n apocalypse-<vm>-swap | md5sum | head -c 16

You will also need a LUN number for each LUN you are adding; these are generally assigned starting from 0 and incrementing with each LUN added. To get the highest numbered LUN check the add.luns file. Change the lines in the add.luns file to match the format shown below. Make sure the LUNs in the add.luns file have been added to the end of the luns file before clearing add.luns.

apocalypse-ns2-root,<LUN number>(add 1 to the previous),/dev/zvol/apocalypse/vms/<vm>/root,<SCSI ID>
apocalypse-ns2-swap,<LUN number>(add 1 to the previous),/dev/zvol/apocalypse/vms/<vm>/swap,<SCSI ID>

Then, run the add-luns.sh script.


Finally, each VM Server needs to be told to rescan for iSCSI LUN changes. IMPORTANT - DO NOT restart iscsid or you will crash all of the VMs on the server; rather use the following command to instruct iscsid to scan for changes.

 iscsiadm -m session --rescan

Multipath Configuration

Multipath now needs to be configured on the client servers. This is most easily done on one server and then copied to the others. On one of the client servers, run:


Then, for each LUN you are adding, run:

 ls /dev/mapper/ | grep 090427202e6db84c #(replace this with the SCSI_SN of the LUN)

For each LUN, add an entry in /etc/multipath.conf similar to the following; replacing the WWID with the value returned above, and the alias with the name of the LUN.

 multipath {
     wwid 36001405090427202e6db84c000000000
     alias apocalypse-ion-root
     features                "1 queue_if_no_path"

Next for each LUN, you need to remove the temporary multipath alias (which defaults to the WWID) by running:

 multipath -f 36001405090427202e6db84c000000000 #(replace this with the WWID)

Finally, re-run the multipath command to regenerate the multipath devices with the new aliases.

You should now have an entry in /dev/mapper/ for each LUN you added to the SAN. Once you have verified that everything is working, you need to replicate this configuration across the other systems connected to the SAN. Copy the updated /etc/multipath.conf to them, then run:

 iscsiadm -m session --rescan

See the main SAN article for a list of systems currently connected to the SAN via iSCSI.