Changeset 2380 in MondoRescue for branches/2.2.9/mindi


Ignore:
Timestamp:
Sep 9, 2009, 8:30:47 PM (15 years ago)
Author:
Bruno Cornec
Message:
  • Change NFS support into a NetFS support to allow for multiple protocol in addition to NFS (NEEDS TESTING)
  • Better logging to detect a potential nuke issue
Location:
branches/2.2.9/mindi
Files:
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi/README.pxe

    r2191 r2380  
    1111label mondo
    1212        kernel vmlinuz-mondo
    13         append initrd=initrd-mondo load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=131072 rw root=/dev/ram iso acpi=off apm=off devfs=nomount exec-shield=0 pxe [prefix=machine] [ipconf=(ipdev:ipadr:netmask:broadcast:gateway|ipdev:dhcp)] [nfsmount=server:mountpoint] [nfspath=local_path] [ping=#] ...
     13        append initrd=initrd-mondo load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=131072 rw root=/dev/ram iso acpi=off apm=off devfs=nomount exec-shield=0 pxe [proto=nfs|sshfs] [prefix=machine] [ipconf=(ipdev:ipadr:netmask:broadcast:gateway|ipdev:dhcp)] [netfsmount=server:mountpoint] [netfspath=local_path] [ping=#] ...
    1414
    1515ipdev is the device name (e.g. eth2)
     
    1919gateway is the default gateway (e.g. 192.168.1.254)
    2020dhcp is a keyword. Using it will provide all the previous 4 values to activate the LAN interface.
    21 server is the ip addr of the NFS server
    22 mountpoint is the mount point on the NFS server to use (should be in /etc/exports of the NFS server)
     21proto is the protocol to use for mounting the remote share (default is NFS, sshfs is also available)
     22server is the ip addr of the Remote Network server
     23mountpoint is the mount point on the Remote Network server to use (if NFS, should be in /etc/exports of the NFS server)
     24netfsmount is the server and mountpoint on which the ISO is available, if different from the one at backup time. For SSHFS the server part can be of the form user@server.
     25netfspath is the local path on the remote server where the image is located, if different from the one at backup time.
    2326local_path is the local directory under which the mage was made (with the -d option)
    2427rmadisk_size may have to be increase to 131072 on more recent distributions such as rhel 5
     
    4043Without prefix keyword, the name of the images used during archiving with the -p option will be used (they may differ). If -p wasn't used then the name mondorescue-1.iso, ... will be used.
    4144
    42 During boot mondorestore will start your NFS configuration and mount mondo's content from the network rather than from a physical media. You may alter the IP configuration stored from the original machine by passing the ipconf option describing respectively the IP address, netmask, broadcast and default gateway you want to setup for the machine, separated by ':'. Or alternatively, you may specify the dhcp keyword so that a DHCP request is made to get those information. In the 2 cases, you have to mention on which physical interface those parameters should apply. On some configurations, you may also want to increase the number of ping queries made before the NFS mount, which is of 3 by default, using the ping option and give the number you want. If you have a different NFS server for the deployment than for the archiving, you can also precise it through the nfsmount option. The structure on both server under the mountpoint has to be the same.
     45During boot mondorestore will start your NFS configuration and mount mondo's content from the network rather than from a physical media. You may alter the IP configuration stored from the original machine by passing the ipconf option describing respectively the IP address, netmask, broadcast and default gateway you want to setup for the machine, separated by ':'. Or alternatively, you may specify the dhcp keyword so that a DHCP request is made to get those information. In the 2 cases, you have to mention on which physical interface those parameters should apply. On some configurations, you may also want to increase the number of ping queries made before the NFS mount, which is of 3 by default, using the ping option and give the number you want. If you have a different NFS server for the deployment than for the archiving, you can also precise it through the netfsmount option. The structure on both server under the mountpoint has to be the same.
    4346
    4447CAVEAT: the limit to the number of char on the append line is 255. Use symlinks to reduce the size of your path if needed.
     
    4649Please report any problem around that tool to bruno@mondorescue.org
    4750
     512009-09-09 Changed to netfs for multi protocol support (nfs, sshfs, ...)
    48522009-05-07 nfspath added to allow redeployment from another NFS directory
    49532006-06-10 nfsmount added to allow redeployment from another NFS server
  • branches/2.2.9/mindi/deplist.txt

    r2222 r2380  
    4646/bin/mount
    4747/sbin/mount.nfs /sbin/mount.nfs4
    48 /sbin/mount.fuse
     48/usr/bin/sshfs
     49/sbin/mount.fuse /usr/bin/fusermount /usr/bin/ulockmgr_server
    4950/sbin/mount.cifs /sbin/mount.cifs3
    5051/sbin/mount.smb /sbin/mount.smb3
  • branches/2.2.9/mindi/mindi

    r2344 r2380  
    5757PCMCIA_MODS="pcmcia_core ds yenta_socket"
    5858USB_MODS="usb-storage usb-ohci usb-uhci usbcore usb_storage input hid uhci_hcd ehci_hcd uhci-hcd ehci-hcd ohci-hcd ohci_hcd usbkbd usbhid keybdev mousedev libusual scsi_mod ff-memless"
    59 NET_MODS="sunrpc nfs nfs_acl lockd fscache loop mii 3c59x e100 bcm5700 bnx2 e1000 e1000e igb eepro100 ne2k-pci tg3 libphy pcnet32 8139cp 8139too 8390 forcedeth vmxnet vmnet exportfs"
     59NET_MODS="sunrpc nfs nfs_acl lockd fscache loop mii 3c59x e100 bcm5700 bnx2 e1000 e1000e igb eepro100 ne2k-pci tg3 libphy pcnet32 8139cp 8139too 8390 forcedeth vmxnet vmnet exportfs fuse"
    6060CDROM_MODS="$TAPE_MODS $IDE_MODS $USB_MODS $PCMCIA_MODS $SCSI_MODS $NET_MODS af_packet cdrom isocd isofs inflate_fs nls_iso8859-1 nls_base nls_cp437 nls_utf8 sg sr_mod zlib_inflate iso9660"
    6161# Those modules will only go on the backup media, not the boot media.
    62 EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid10 raid5 raid456 lvm-mod dm-mod dm_mod dm-snapshot dm_snapshot dm-zero dm_zero dm-mirror dm_mirror dm-multipath dm-round-robin dm-emc dm-hp-sw dm-rdac multipath jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd mbcache ext4 jbd2 crc16 fuse"
     62EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid10 raid5 raid456 lvm-mod dm-mod dm_mod dm-snapshot dm_snapshot dm-zero dm_zero dm-mirror dm_mirror dm-multipath dm-round-robin dm-emc dm-hp-sw dm-rdac multipath jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd mbcache ext4 jbd2 crc16"
    6363# Replace with that line for HP OCMP e.g.
    6464#DENY_MODS="MPS_Driver_Mapper mps octtldrv tscttl streams kqemu fdomain"
     
    592592        fi
    593593        cp -f $MINDI_TMP/BOOTLOADER.* $bigdir 2>> $LOGFILE || LogIt "\nMondo v1.2x defaults to LILO as the bootloader, BTW."
    594         if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
    595             LogIt "\nIncorporating NFS-related settings"
    596             for r in NFS-* ISO-PREFIX ; do
     594        if [ -e "$MINDI_TMP/NETFS-DEV" ] ; then
     595            LogIt "\nIncorporating Network-related settings"
     596            for r in NETFS-* ISO-PREFIX ; do
    597597                cp -f $MINDI_TMP/$r $bigdir/tmp 2>> $LOGFILE || Die "Cannot copy $r - did you run out of disk space?"
    598598                echo "Copying $r to ramdisk" >> $LOGFILE
     
    920920    echo "datestamp `date`" >> $outfile
    921921    [ "$ESTIMATED_TOTAL_NOOF_SLICES" ] && echo "total-slices $ESTIMATED_TOTAL_NOOF_SLICES" >> $outfile
    922     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-IPADDR nfs-client-ipaddr $outfile
    923     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-NETMASK nfs-client-netmask $outfile
    924     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-BROADCAST nfs-client-broadcast $outfile
    925     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-DEFGW  nfs-client-defgw  $outfile
    926     AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-MOUNT  nfs-server-mount  $outfile
    927     AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-PATH   nfs-server-path   $outfile
    928     AddFileToCfgIfExists $MINDI_TMP/NFS-DEV           nfs-dev           $outfile
    929     AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-IPADDR nfs-server-ipaddr $outfile
     922    AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-IPADDR netfs-client-ipaddr $outfile
     923    AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-NETMASK netfs-client-netmask $outfile
     924    AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-BROADCAST netfs-client-broadcast $outfile
     925    AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-DEFGW  netfs-client-defgw  $outfile
     926    AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-MOUNT  netfs-server-mount  $outfile
     927    AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-PATH   netfs-server-path   $outfile
     928    AddFileToCfgIfExists $MINDI_TMP/NETFS-DEV           netfs-dev           $outfile
     929    AddFileToCfgIfExists $MINDI_TMP/NETFS-PROTO         netfs-proto           $outfile
     930    AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-IPADDR netfs-server-ipaddr $outfile
    930931    AddFileToCfgIfExists $MINDI_TMP/ISO-DEV           iso-dev           $outfile
    931932    AddFileToCfgIfExists $MINDI_TMP/ISO-MNT           iso-mnt           $outfile
     
    15081509    if [ _"$MONDO_SHARE" != _"" ]; then
    15091510        if [ "$CDRECOVERY" != "yes" ] ; then
    1510             if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1511            if [ -e "$MINDI_TMP/NETFS-DEV" ] ; then
    15111512                echo -en "Press <enter> to continue.\n"
    15121513            elif [ ! "$MINDI_TMP" ] ; then
     
    15511552    # In case it's mondoarchive
    15521553    elif [ _"$MONDO_SHARE" != _"" ]; then
    1553         if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1554        if [ -e "$MINDI_TMP/NETFS-DEV" ] ; then
    15541555            echo -en "default${sep}iso\n"
    15551556        else
     
    23412342    list_of_groovy_mods="$CDROM_MODS $FORCE_MODS"
    23422343
    2343     if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     2344    if [ -e "$MINDI_TMP/NETFS-DEV" ] ; then
    23442345        # For PXE boot
    23452346        list_of_groovy_mods="$list_of_groovy_mods $NET_MODS"
  • branches/2.2.9/mindi/rootfs/sbin/init

    r2353 r2380  
    719719fi
    720720if [ "`grep -i pxe /proc/cmdline`" ] || [ "`grep -i net /proc/cmdline`" ]; then
    721     # We need to get here exported variables from start-nfs
    722     . /sbin/start-nfs
     721    # We need to get here exported variables from start-netfs
     722    . /sbin/start-netfs
    723723fi
    724724
     
    732732    ExtractDataDisksAndLoadModules
    733733    # Fake the conf file to force it to NFS mode, even if we made originally a CD (mandatory for mondorestore to work correctly)
    734     sed -i "s/backup-media-type.*/backup-media-type nfs/" /tmp/mondo-restore.cfg
     734    sed -i "s/backup-media-type.*/backup-media-type netfs/" /tmp/mondo-restore.cfg
    735735elif [ "`grep -i usb= /proc/cmdline`" ] || [ "`grep -i usb /tmp/mondo-restore.cfg 2>/dev/null | grep media-type`" ]; then
    736736    . /sbin/start-usb
     
    743743    HandleCDROM
    744744    ExtractDataDisksAndLoadModules
    745     # We need to get here exported variables from start-nfs
    746     . /sbin/start-nfs
     745    # We need to get here exported variables from start-netfs
     746    . /sbin/start-netfs
    747747fi
    748748res=$?
     
    843843    LogIt "backup-media-type is specified in config file - great."
    844844    LogIt "Calling post-init"
    845     # start-nfs moved it under /tmp as the NFS share is already unmounted
     845    # start-netfs moved it under /tmp as the NFS share is already unmounted
    846846    if [ "`echo $pre | grep -E '^/tmp/isodir'`" ]; then
    847847        post=`echo $pre | sed 's|^/tmp/isodir|/tmp|'`
     
    861861        echo $i | grep -qi post= && post=`echo $i | cut -d= -f2`
    862862    done
    863     # start-nfs moved it under /tmp as the NFS share is already unmounted
     863    # start-netfs moved it under /tmp as the NFS share is already unmounted
    864864    if [ "`echo $post | grep -E '^/tmp/isodir'`" ]; then
    865865        post=`echo $post | sed 's|^/tmp/isodir|/tmp|'`
  • branches/2.2.9/mindi/rootfs/sbin/start-netfs

    r2377 r2380  
    33# $Id$
    44#
    5 # This script sets up the network + NFS environment if needed.
     5# This script sets up the network + Network FS environment if needed.
    66#
    77
     
    1111
    1212# Get info from config file
    13 ipdev=`grep nfs-dev /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    14 ipaddress=`grep nfs-client-ipaddr /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    15 ipnetmask=`grep nfs-client-netmask /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    16 ipbroadcast=`grep nfs-client-broadcast /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    17 ipgateway=`grep nfs-client-defgw /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     13ipdev=`grep netfs-dev /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     14ipaddress=`grep netfs-client-ipaddr /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     15ipnetmask=`grep netfs-client-netmask /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     16ipbroadcast=`grep netfs-client-broadcast /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     17ipgateway=`grep netfs-client-defgw /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     18proto=`grep netfs-proto /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    1819ipconf=""
    1920pre=""
    2021post=""
    21 export nfsmount=`grep nfs-server-mount /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     22export netfsmount=`grep netfs-server-mount /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    2223export imgname=`grep iso-prefix /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    2324if [ "$imgname" = "" ]; then
    2425    export imgname="mondorescue"
    2526fi
    26 export dirimg=`grep nfs-server-path /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     27export dirimg=`grep netfs-server-path /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    2728if [ "$dirimg" = "" ]; then
    2829    export dirimg="/"
     
    3334    echo $i | grep -qi ping= && ipcount=`echo $i | cut -d= -f2`
    3435    echo $i | grep -qi ipconf= && ipconf=`echo $i | cut -d= -f2`
    35     echo $i | grep -qi nfsmount= && export nfsmount=`echo $i | cut -d= -f2`
     36    echo $i | grep -qi netfsmount= && export netfsmount=`echo $i | cut -d= -f2`
    3637    echo $i | grep -qi prefix= && export imgname=`echo $i | cut -d= -f2`
    37     echo $i | grep -qi nfspath= && export dirimg=`echo $i | cut -d= -f2`
     38    echo $i | grep -qi netfspath= && export dirimg=`echo $i | cut -d= -f2`
    3839    echo $i | grep -qi pre= && pre=`echo $i | cut -d= -f2`
    3940    echo $i | grep -qi post= && post=`echo $i | cut -d= -f2`
     41    echo $i | grep -qi proto= && proto=`echo $i | cut -d= -f2`
    4042done
    4143
     
    6769
    6870    # ping server helps waking interface up
    69     LogIt "Pinging NFS server..."
    70     nfs_server_ipaddr=`echo $nfsmount | cut -d: -f1`
    71     ping -c $ipcount $nfs_server_ipaddr
     71    LogIt "Pinging Remote server..."
     72    netfs_server_ipaddr=`echo $netfsmount | cut -d: -f1 | cut -d@ -f2`
     73    ping -c $ipcount $netfs_server_ipaddr
    7274
    73     # Finally mounts the NFS share
    74     LogIt "Mounting NFS share ($nfsmount) on /tmp/isodir..."
    75     touch /etc/mtab
    76     mount -t nfs -o nolock,ro $nfsmount /tmp/isodir
     75    # Which is our protocol for file sharing
     76    if [ "$proto" = "" ]; then
     77        LogIt "No protocol specified, defaulting to NFS"
     78        $proto = "nfs"
     79    fi
     80
     81    if [ "$proto" = "sshfs" ]; then
     82        LogIt "Mounting SSHFS share ($netfsmount) on /tmp/isodir..."
     83        sshfs -o ro $netfsmount /tmp/isodir
     84    elif [ "$proto" != "" ]; then
     85        LogIt "Mounting Network share ($netfsmount) on /tmp/isodir..."
     86        touch /etc/mtab
     87        mount -t $proto -o nolock,ro $netfsmount /tmp/isodir
     88    else
     89        LogIt "Unknown protocol $proto"
     90    fi
    7791   
    78     LogIt "Mounting NFS image ${imgname}-1.iso in $dirimg on /mnt/cdrom in loopback"
     92    LogIt "Mounting Remote image ${imgname}-1.iso in $dirimg on /mnt/cdrom in loopback"
    7993    mount -o ro,loop -t iso9660 /tmp/isodir/$dirimg/${imgname}-1.iso /mnt/cdrom
    8094
    81     # Save the scripts on the NFS share locally
     95    # Save the scripts on the Network share locally
    8296    if [ "`echo $pre | grep -E '^/tmp/isodir'`" ]; then
    8397        cp $pre /tmp
Note: See TracChangeset for help on using the changeset viewer.