Openfiler Will Not Map iSCSI Luns to iSCSI Targets (Part 2)

In my previous post with this title, I went through installing a script to rebuild the openfiler volumes.xml file on every reboot. This works great for iSCSI, but yesterday I added an NFS volume. On reboot, it was marked as iSCSI. Turns out that the script only works for iSCSI, even though it’s supposed to work for all the supported openfiler volume types.

First, a quick review of the problem.

  • My mdadm software raid array will not auto-assemble when called by the default lines in /etc/rc.
  • Because of this, LVM does not load the volume.
  • Openfiler deletes the volumes.xml entry once it starts since the volume is gone.
  • When I manually start /dev/md0 with “mdadm –assemble –scan” and restart the openfiler service my volumes do not reappear.
Here’s how I got everything working:
  • call the mdadm twice in /etc/rc.sysinit to get the array to assemble before LVM starts.
  • remove /etc/rc3.d/S85Openfiler so that openfiler doesn’t automatically start on reboot.
  • crontab script to backup volumes.xml every 1 minute.
  • edit /etc/rc.local to restore the backup volumes.xml and start the openfiler service.
The result? Everything works as advertised. Here’s how you do it.

The Process

1) Edits to /etc/rc.sysinit

Find the lines below in your /etc/rc.sysinit file, and add the lines that say “added by JP”.

# Start any MD RAID arrays that haven't been started yet
[ -r /proc/mdstat -a -r /dev/md/md-device-map ] && /sbin/mdadm -IRs

if [ -x /sbin/lvm ]; then
        export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
        action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a y --ignorelockingfailure --ignoremonitoring
        unset LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES
fi

#This section added by JP 08/19/11 to fix software raid not auto-assembling.
/sbin/mdadm --assemble --scan
#If you notice that a specific volume group won't activate properly add this line too:
#You can diagnose this with 'lvscan' then 'vgscan'
#/sbin/vgchange -ay VGName

if [ -f /etc/crypttab ]; then
    init_crypto 0
fi

if [ -f /fastboot ] || strstr "$cmdline" fastboot ; then
        fastboot=yes
fi

2) rc.3 changes

  1. rm /etc/rc3.d/S85Openfiler

3) Crontab Additions

  1. crontab -e
  2. add the following line:
    * * * * * cp -f /opt/openfiler/etc/volumes.xml /root/volumes.xml.DONOTDELETE.bak

4) /etc/rc.local Additions

Here is my /etc/rc.local:

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

#reactive lvm volumes
###if your LV's don't come online you might need the lines below:
#lvchange -Ay /dev/VGName/LVName
#lvchange -Ay /dev/VGName/LVName
#lvchange -Ay /dev/VGName/LVName
#restore volumes in the Openfiler GUI
cp /root/volumes.xml.DONOTDELETE.bak /opt/openfiler/etc/volumes.xml

#resart iscsi-target service because it doesn't work right for some reason at this point
service iscsi-target restart

#restart openfiler service with all volumes
service openfiler start

After all this; my openfiler box is now working properly with NFS :). Good luck!

Advertisements

2 thoughts on “Openfiler Will Not Map iSCSI Luns to iSCSI Targets (Part 2)

  1. Pingback: Openfiler Will Not Map iSCSI Luns to iSCSI Targets « windowsmasher

  2. Pingback: Table of Contents | windowsmasher

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s