Groesbeek, view of the 'National Liberation Museum 1944-1945' in Groesbeek. © Ton Kersten tonkersten.com | Tue Aug 17, 2010 | © Ton Kersten - PA1TON
Most of this template stuff is borrowed ("stolen") from Miek Gieben
stopsoftwarepatents.eu petition banner

September 2009 Archives - Thoughts of a geek

September 2009 Archives

OpenFiler repair exercise

Ton Kersten / 2009-09-16 09:55:49 CEST / Permanent link / news, Linux

At our local radio station (Omroep Groesbeek) we use OpenFiler version 2.3 for our storage solution.

Yesterday, however, we didn't have a storage solution but a storage problem. None of the exported disks could be accessed, neither through Samba nor NFS. Further investigation showed that the operating disk was completely kaputt. I tried to make a clone of the disk with CloneZilla but the clone failed and the new file systems where unusable as well.

Well, after whining for some time, I decided it was time for a complete re-install to save as much data as possible. Installation went superb and I saw and could mount our data volumes. Hurray, the data was save. Now I only needed to reimport the volumes into OpenFiler. Problem was that the OpenFiler GUI does not have a function for this. With all original config files gone I even didn't have an example how to fix them.

Surely Google is your friend and searching showed that Nathan Jones created a script just for this type of situation. Clicking the link gave a '404', crap! Not all was lost, however, because I now knew the name of the script he made, remake_vol_info and again Google to the rescue. I found a sample script that should do what I need. I tweaked it a little and executed it.

This is the script

#!/bin/bash

# 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>" > _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 != "iscsi" ]
    then
        echo "$i $mntpoint $fstype defaults,usrquota,grpquota$args 0 0" >> _fstab
        echo "  <volume id=\"$volid\" name=\"$volid\" mountpoint=\"$mntpoint\" vg=\"$vgname\" fstype=\"$fstype\" />" >> _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 "  <volume id=\"$volid\" name=\"$volid\" mountpoint=\"\" vg=\"$vgname\" fstype=\"$fstype\" incominguser=\"\" incomingpassword=\"\" outgoinguser=\"\" outgoingpassword=\"\" />" >> _volumes.xml
    fi
done;
echo "</volumes>" >> _volumes.xml

mv -f _fstab /etc/fstab
mv -f _volumes.xml /opt/openfiler/etc/volumes.xml
chown openfiler.openfiler /opt/openfiler/etc/volumes.xml

Reboot and all volumes where visible in the OpenFiler GUI. Just needed to add the network and Samba and NFS exports and everything was up and running again.

Whoever posted the script: Thanks, it saved me a lot of time.



git RPM's online

Ton Kersten / 2009-09-14 12:13:16 CEST / Permanent link / news, nice_tools

Using git on a daily basis now, it bugged me that there are no RPM's for git on CentOS 5.3. At the git download site it's possible to download versions for Fedora 9, but that's not what I want or need.

So I decided to make my own. Downloading the source, unpacking and running make git.spec gave me a basic spec file to start with.
After minor tweaks I tried to cook the RPM, but I was in for a surprise.

The build process crashed because the docs could not be built.
After some investigation I found that CentOS 5.3 thinks that files it installed from the CentOS repo are unsafe.

So building the docs needs a ASCIIDOC_EXTRA = --unsafe in the Makefile.

After that the build crashed because the file git-filter-branch.txt contains +++ somewhere. Removing them helps.

Oke, now we can have RPM's, but no gitweb?? So I added that as well and added the patch that we can have tabstops of 4 instead of 8.

The RPM's are in the files section, with the source RPM, that contains the spec file.