#!/bin/sh # RDisk - Rescue Disk: use "mkbootdisk" to make a rescue disk for this system # an gather other useful information. # http://www.jpsdomain.org/linux/OnStream_DI-30-RedHat_Backup_mini-HOWTO.html # v1.0 08-Nov-1998 JPV # v1.3 28-Nov-1999 JPV Updated for new Disk (hdc1) # v1.4 21-Sep-2000 JPV, updated for new RH 6.2 Kernel # v1.5 21-Sep-2000 JPV, added "fdisk.info" stuff # v1.6 16-Feb-2001 JPV, added "rpm -qa" stuff, updated kernel # v1.7 20-Feb-2001 JPV, added nofpy parameter and variables for cmd paths # v1.8 30-Jul-2001 JPV, changed floppy dest dir from /fpy to /a (and docs) # v1.9 2002-06-05 JPV, Updated mkkickstat notes for RedHat 7.2, added # `ls /boot/vmlinuz-* | cut -d - -f 2-`, added --verbose to mkbootdisk # added mkdir too... # v1.10 2002-10-21 JPV, minor updates for RH 8.0, corrected some missed # variables # v1.11 2002-11-09 JPV, minor changes for *-ks.cfg # Copyright 2001-2002 JP Vossen # This script is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # In no event shall the author be liable for any damages whatsoever # (including, without limitation, damages for loss of business profits, # business interruption, loss of business information, or any other # pecuniary loss) arising out of the use of or inability to use this script. # NOTES: # 1. This script requires that you have a working floppy drive, with an # appropriate /etc/fstab entry. My /etc/fstab has this: # /dev/fd0 /mnt/floppy auto noauto,owner 0 0 # I have a symlink to /a -> /mnt/floppy # This lets people who expect to find stuff in /mnt be OK, but is easier # for me to type. # 2. OBSOLETE: Every time you update the kernel, you have to update the mkbootdisk # line too. `ls /boot/vmlinuz-* | cut -d - -f 2-` does this now. # 3. I only grab fdisk -l info from /dev/hda, if you have more hard # drives, add them too. # 4. You can do everything but the floppy stuff by "$0 nofpy" # 5. Since this may not always run "su -" I have included paths. You'll # have to adjust them if your system is different. # 6. mkkickstart is being deprecated in favor of ksconfig. The problem is # that ksconfig is graphical only :-(! I'm investigating... # 7. You might want to think about installing and running RedHat's sysreport # too. That had lots of good (debugging) info, but is a bit overkill # for the scope of this script... RDISKDIR=/root/rdisk CAT=/bin/cat CP=/bin/cp DATE=/bin/date DF=/bin/df ECHO=/bin/echo FDISK=/sbin/fdisk MKBOOTDISK=/sbin/mkbootdisk MKDIR=/bin/mkdir MOUNT=/bin/mount UMOUNT=/bin/umount KICKSTART=*-ks.cfg MKKICKSTART=/usr/sbin/mkkickstart # GUI only! :-( KSCONFIG=/usr/sbin/ksconfig if [ -z "$1" ]; then ${ECHO} "" ${ECHO} Making boot disk... # ${MKBOOTDISK} --device /dev/fd0 2.4.9-31smp ${MKBOOTDISK} --verbose --device /dev/fd0 `ls /boot/vmlinuz-* | cut -d - -f 2-` fi # Check for and make directory if [ ! -d "${RDISKDIR}" ]; then ${ECHO} "" ${ECHO} Making ${RDISKDIR} directory... ${MKDIR} -p ${RDISKDIR} fi # Gather some disk info ${DATE} > ${RDISKDIR}/fdisk.info ${ECHO} "" ${ECHO} Getting df -h... ${ECHO} "" >> ${RDISKDIR}/fdisk.info ${ECHO} "df -h" >> ${RDISKDIR}/fdisk.info ${ECHO} "-----" >> ${RDISKDIR}/fdisk.info ${DF} -h >> ${RDISKDIR}/fdisk.info ${ECHO} "" ${ECHO} Adding fdisk info... ${ECHO} "" >> ${RDISKDIR}/fdisk.info ${ECHO} "fdisk -l" >> ${RDISKDIR}/fdisk.info ${ECHO} "--------" >> ${RDISKDIR}/fdisk.info ${ECHO} "" >> ${RDISKDIR}/fdisk.info ${FDISK} -l >> ${RDISKDIR}/fdisk.info ${ECHO} "" ${ECHO} Adding fstab... ${ECHO} "" >> ${RDISKDIR}/fdisk.info ${ECHO} "/etc/fstab" >> ${RDISKDIR}/fdisk.info ${ECHO} "----------" >> ${RDISKDIR}/fdisk.info ${CAT} /etc/fstab >> ${RDISKDIR}/fdisk.info ${ECHO} "" >> ${RDISKDIR}/fdisk.info # Create KickStart info too, can use to rebuild from CD-ROM #if [ -f "${MKKICKSTART}" ]; then # ${ECHO} "" # ${ECHO} Making kickstart file... # ${MKKICKSTART} --force > /root/rdisk/kickstart.info #fi # RENAMED ${ANACONDA} to ${KICKSTART} #if [ -f "/root/${ANACONDA}" ]; then # ${ECHO} "" # ${ECHO} Copying anaconda-ks file... # ${CP} -f /root/${ANACONDA} ${RDISKDIR}/${ANACONDA} #fi ${CP} -f /root/${KICKSTART} ${RDISKDIR}/${KICKSTART} 2> /dev/null ${CP} -f /root/ks.cfg ${RDISKDIR}/ks.cfg 2> /dev/null # Create RPM Info ${ECHO} "" ${ECHO} Getting RPM info... ${DATE} > ${RDISKDIR}/rpm-qa.info ${ECHO} "" >> ${RDISKDIR}/rpm-qa.info rpm -qa >> ${RDISKDIR}/rpm-qa.info if [ -z "$1" ]; then ${ECHO} "" ${ECHO} Copying files to floppy... # Copy the fdisk.info & kickstart files to the floppy ${MOUNT} /a ${CP} ${RDISKDIR}/*.info /a ${CP} ${RDISKDIR}/${KICKSTART} /a ${UMOUNT} /a ${ECHO} -e "\tDon't forget to remove the floppy and store it someplace safe!" fi ${ECHO} "" ${ECHO} "$0 Finished..." ${ECHO} ""