Changeset 3119 in MondoRescue


Ignore:
Timestamp:
May 10, 2013, 8:54:24 PM (11 years ago)
Author:
Bruno Cornec
Message:

r5281@localhost: bruno | 2013-05-08 11:56:49 +0200

  • Fix support for OBDR tapes on SCSI cards: in some cases the tape remains in OBDR mode (aka CDROM emulation) preventing the init script to work correctly. It now try to detect these cases, and to reset the SCSI device being of type CDROM (5) and looking like a tape drive as a model. (Not tested yet)
  • Improve in consequence the OBDR specific README
  • Adds support for the obdrmods boot parameter if some additional drivers should be removed
  • adds rev to the minimal list of tools to have as this is now potentially required
Location:
branches/3.0/mindi
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mindi/README.bootparam

    r3051 r3119  
    6060    Call mondorestore with -o and the tape device
    6161
     62obdrmods="mod1 mod2"
     63    Remove these modules in order to be able to reset the tape dvice using it and place it in sequential mode. A default list of modules is aloready embedded so this should only be used if the list is unsufficient. Please report that usage to dev team.
     64
    6265pre=/path/to/script
    6366    Execute a pre-configuration script before calling mondorestore. Could be an NFS shared script e.g., or a script located in the initrd. Eg: pre=/tmp/isodir/my-pre.sh. Note that the script should be executable.
  • branches/3.0/mindi/README.obdr

    r2997 r3119  
    44
    55You need to use the options -o and -t of mondoarchive to activate it.
    6 You may also need an additional software (hpsa_obdr_mode) if using HP ProLiant servers, in order to put th tape drive in the right mode from the command line (also in case of problem after OBDR boot, when the drive doesn't come back alone into tape mode Cf: http://trac.mondorescue.org/ticket/358)
    7 That software is available from http://cciss.sf.net/ and http://trac.mondorescue.org/attachment/ticket/358/hpsa_obdr_mode.c + http://trac.mondorescue.org/attachment/ticket/358/Makefile
     6You may also need an additional software (hpsa_obdr_mode) if using a tape drive attached to the Smart Array controller of a HP ProLiant servers, in order to put the tape drive in the right mode from the command line (also in case of problem after OBDR boot, when the drive doesn't come back alone into tape mode Cf: http://trac.mondorescue.org/ticket/358). That software is available from http://cciss.sf.net/ and http://trac.mondorescue.org/attachment/ticket/358/hpsa_obdr_mode.c + http://trac.mondorescue.org/attachment/ticket/358/Makefile
     7You may also need an additional software (sg_wr_mode) if using a tape drive attached to a SCSI controller of a server, in order to put the tape drive in the sequential mode after OBDR boot, when the drive doesn't come back alone into that mode. That software is available within the sg3_utils package.
    88
    9 Here is an example script showing how to setup the tape based DR correctly completely from the CLI on SLES 10 on a ProLiant server using an internal SAS DAT 160 tape drive:
     9Here is an example script showing how to setup the tape based DR correctly completely from the CLI on SLES 10 on a ProLiant server using an internal SAS DAT 160 tape drive connected to the embedded Smart Array controller:
    1010
    1111# Create some temp dirs for mondoarchive
     
    2323#reboot
    2424
    25 The machine is backed up and then rebooted in the OBDR mode ... without using the button ;-)
     25The machine is backed up and then rebooted in the OBDR mode ... without even using the button ;-)
     26
     27Here is an example script showing how to setup correctly at restore time the tape completely from the CLI on SLES 11 on a ProLiant server using an external SAS Ultrium 4 tape drive connected to a SCSI controller:
     28
     29# Determine which generic SCSI device needs to be used - It may appear as a CD if in OBDR mode (non sequential)
     30sg_map
     31[...]
     32/dev/sg1  /dev/scd1
     33[...]
     34# you may cross check with cat /proc/scsi/scsi
     35#
     36# Inquire in which mode the tape is (CD-rom drive == 0x05, tape drive == 0x01)
     37sg_inq -d /dev/sg1
     38[...]
     39Device_type=5
     40
     41# Reset the device in order to be in Sequential mode again
     42sg_reset -d /dev/sg1
     43
     44# Remove all related drivers and reload them
     45rmmod st
     46rmmod mptsas
     47rmmod mptspi
     48modprobe mptspi
     49modprobe mptsas
     50modprobe st
  • branches/3.0/mindi/deplist.d/minimal.conf

    r3083 r3119  
    2222/sbin/pidof
    2323/etc/init.d/functions
     24/usr/bin/rev
    2425# On ArchLinux
    2526/bin/pidof
  • branches/3.0/mindi/rootfs/etc/init.d/rcS

    r3090 r3119  
    142142    [ ! "$tapedev" ] && tapedev=`grep media-dev /tmp/mondo-restore.cfg 2>/dev/null | tr -s ' ' ' ' | cut -d' ' -f2`
    143143    mt -f $tapedev rewind
     144    if [ $? -ne 0 ]; then
     145        LogIt "WARNING: $tapedev failed to rewind, either not a tape or still in OBDR mode." 1
     146        LogIt "         Trying to find the corresponding SCSI generic device." 1
     147        c=0
     148        for d in `ls /sys/class/scsi_device/*`; do
     149            devtype=`cat $d/device/type`
     150            if [ _"$devtype" -eq _"1" ]; then
     151                LogIt "NOTE: Device /dev/sg$c is a Sequential device." 1
     152                if [ -x /usr/bin/sg_map ]; then
     153                    dev=`/usr/bin/sg_map | grep -E "^/dev/sg$c" | awk '{print $2}'`
     154                    LogIt "      Retry using device $dev" 1
     155                fi
     156            elif [ _"$devtype" -eq _"0" ]; then
     157                # Skipping a HDD
     158            elif [ _"$devtype" -eq _"5" ]; then
     159                # Checking whether it's a CD or a tape in OBDR mode
     160                grep -q -i -E 'dat|ultrium|tape' $d/device/model
     161                if [ $? -eq 0 ]; then
     162                    # Is probably a Tape drive left in OBDR.
     163                    LogIt "Found that /dev/sg$c is a tape drive (`cat $d/device/model`)." 1
     164                    grep -q -i -w 'hp' $d/device/vendor
     165                    if [ $? -eq 0 ]; then
     166                        LogIt "This is an HP tape drive, even better :-)." 1
     167                    fi
     168                    if [ -x /usr/bin/sg_reset ]; then
     169                        OBDR_MODS="st mptsas mptspi aic7xxx aic94xx mpt2sas "
     170                        if [ "`grep -i obdrmods /proc/cmdline`" ]; then
     171                            OBDR_MODS="$OBDR_MODS `cat /proc/cmdline | sed 's~.*obdrmods=\"\(.*\)\".*~\1~'`"
     172                        fi
     173                        LogIt "Removing modules $OBDR_MODS." 1
     174                        for m in $OBDR_MODS; do
     175                            rmmod $i
     176                        done
     177                        LogIt "Trying to force device /dev/sg$c to be in sequential mode." 1
     178                        /usr/bin/sg_reset -d /dev/sg$c
     179                        LogIt "Inserting modules `rev $OBDR_MODS`." 1
     180                        for m in `rev $OBDR_MODS`; do
     181                            modprobe $i
     182                        done
     183                        LogIt "Retry again as the device has been set back into sequential mode." 1
     184                        mt -f $tapedev fsf 2
     185                        res=$?
     186                        # exit the loop to continue and return if that previous mt failed.
     187                        # If it succeeded we transparently continue !!
     188                        break
     189                    else
     190                        LogIt "WARNING: Unable to reset /dev/sg$c as the sg_reset command is not availble." 1
     191                    fi
     192                fi
     193            else
     194                LogIt "Device /dev/sg$c has an unknown type $devtype." 1
     195            fi
     196            c=`expr $c + 1`
     197        done
     198
     199        if [ $res -ne 0 ]; then
     200            cd $old_pwd
     201            return $res
     202        fi
     203    fi
     204
    144205    mt -f $tapedev fsf 2
    145206    # 32k is DEFAULT_INTERNAL_TAPE_BLOCK_SIZE
     
    667728}
    668729
    669 
    670730EnableCcissIfAppropriate() {
    671731    local f
Note: See TracChangeset for help on using the changeset viewer.