Openfiler Software Raid Volumes Disappear on Reboot

My software RAID volumes disappear on every reboot of my Openfiler box. For me running lvdisplay, pvdisplay, or pvscan had no results. However, fdisk -l showed my volumes. Openfiler configures software raid volumes with a package named mdadm, so I started there.

The following command will scan your system for unmounted raid members:
mdadm --examine --scan

It should output a UUID number for any arrays it finds. To assemble your arrays for pvscan use the following:
mdadm -A -s

On every reboot I still lose the volumes and get the error, “mdadm: cannot re-read metadata from /dev/.tmp-block-8:33 – aborting”. To resolve this (warning, this is a hack!):

  1. Copy the following code and save it as /root/remake_vol_info2
    #!/bin/bash
    # code taken from: https://forums.openfiler.com/viewtopic.php?id=1036&p=2 post#28
    # strip the /mnt lines from fstab as we will be rebuilding them
    grep /mnt /etc/fstab -v > _fstab
    
    # create the new volumes.xml file
    echo -e "<!--?xml version=\"1.0\" ?-->\n" > _volumes.xml
    
    # find all logical volumes and loop
    for i in `lvdisplay | grep "LV Name" | sed 's/[^\/]*//'`; do
    fstype=`vol_id $i -t 2> /dev/null`;
    mntpoint=`echo $i | sed 's/\/dev\//\/mnt\//'`/
    vgname=`echo $i | cut -d '/' -f3`
    volid=`echo $i | cut -d '/' -f4`
    
    args="";
    if [ "$fstype" == "" ]; then
    # assume iscsi since filesystem is unknown
    fstype="iscsi"
    mntpoint=""
    fi
    if [ $fstype == ext3 ] ; then
    args=",acl,user_xattr"
    fi
    
    if [ $fstype == reiserfs ] ; then
    args=",acl"
    fi
    
    if [ $fstype == xfs ] ; then
    args=""
    fi
    
    if [ $fstype != "iscsi" ]; then
    echo "$i $mntpoint $fstype defaults,usrquota,grpquota$args 0 0" >> _fstab
    echo "" >> _volumes.xml
    
    echo "Mounting $mntpoint"
    mkdir -p $mntpoint > /dev/null 2> /dev/null
    umount $mntpoint 2> /dev/null
    mount $mntpoint
    else
    echo "$i - assuming iSCSI"
    echo " " >> _volumes.xml
    fi
    done;
    echo "" >> _volumes.xml
    
    mv -f _fstab /etc/fstab
    mv -f _volumes.xml /opt/openfiler/etc/volumes.xml
    chown openfiler.openfiler /opt/openfiler/etc/volumes.xml
    
  2. chmod 700 /root/remake_vol_info2
  3. vi /etc/rc.local
  4. add the following:
    mdadm -A -s
    /root/remake_vol_info2
    service openfiler restart
  5. Save, reboot, and hope for the best!

References:

Advertisements

2 thoughts on “Openfiler Software Raid Volumes Disappear on Reboot

  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