Changeset 2937 in MondoRescue for branches/3.1/mondo/src/mondorestore


Ignore:
Timestamp:
Jan 28, 2012, 1:51:28 AM (14 years ago)
Author:
Bruno Cornec
Message:

svn merge -r 2849:2935 ../3.0

  • Adds 3 binaries called potentially by udev o support USB key mount at restore time (Victor Gattegno)
  • mindi only sets the boot flag of a USB device if none is present already (should avoid flip/flop situation)
  • Fix a compatibility bug in analyze-my-lvm whete exclude lists with '|' was incorrectly analyzed (' ' still expected)
  • Precise that -J is not supported by mondorestore yet.
  • Fix a compatibility bug in mindi where exclude lists with '|' was incorrectly analyzed (' ' still expected)
  • Install an MBR on USB devices when possible
  • Improve error message in case mondorestore isn't found
  • Adds support for more virtio devices for KVM restore
  • Improve mbr.bin handling
  • Fix an issue in test of FindKernel for Xen and non Xen cases
    • Fix #492 by removing an extra useless fi
    • Move fvat nd fat modules to CDROM_MODS in order to have them in the initrd to support saving logs to a USB device e.g.
    • Fix an error when dmidecode reports comments before system name
    • Fix previous broken patch on comment management for bkphw
    • Improve msgs printed during kbd analysis
    • Fix a small remaining pb with new comment support
    • Try to again improve the mount/umount stuff in mondo -Adds mention to OEL, CentOS, ScientifLinux as RHEL clones
  • Fix a panadoid_free done on the wrong variable (solve a memory leak)
  • Solve #495 by skipping the potential (auto-read-only) when analyzin /proc/mdstat result
  • Fix some markup in man pages
  • adds the post-nuke script sample for Debian (Guillaume Pernot/Andrée Leidenfrost)
  • Avoid a useless umount when changing of afio set, let insist_on_cd check and perform if needed
  • Copy everything under .ssh of root account to allow for sshfs mount without passwd at restore time.
  • Adds support for bnx2i driver
  • Try to fix #496 by supporting the protocol in the output of the mount command (sshfs#...)
  • Uses the -d option of the mount command to avoid leaving loop devices in use. Probably provoked by the usage of a more recent busybox, but anyway that option doesn't hurt, and does nothing for non-loop devices. Should fix the problems reported on the ML with NFS and more than 8 ISO images (8 being the default number of loop devices available)
  • Attempt to fix #436 by adding some newtDrawForm where appropriate.
  • Fix bugs in the kernel detection routine of mindi (some echo were done without capturing their output, confusing the return). This should also help the Xen detection issue
  • Change the logging function to be nearer from 2.2.10, and start using some
  • Initialize some global fields with an empty string, now that newt Draws more regularly progress forms
  • Mindi progression still not good, but showing now 3% when calling mindi. Would need a specific handling for the progress bar to evolve more afterwards
  • Add compatibility with the latest SSSTK + PSP content for HP ProLiant + branding homogeneous now. We only take conrep out of the SSSTK pending a package availability. Using hpacuscripting now. Review of parameters called following test made.
  • Fix #501 by pushing BOOT_SIZE to 36864 for certain Ubuntu cases
  • Fix some remaining inconsistencis in the ProLiant HW backup. ready for usage.
  • Fix an issue on udevadm call (needs an intermediate variable)
  • Fix a remaining ProLiant tool call
  • Remove again some wrong variable initialization for Net in order to not have strange messages now we call Draw more often
  • Adds support for hwaddr (MAC addresses) at restore time, and map to the correct NIC if it's found at restore time (based on code from Stefan Heijmans)
  • Try to Fix #499 by changing init in order to never exit, and rebooting using sysrq in /proc (not portable). Maybe should move to using a real init, and a separated rcS script.
  • Fixes the shell msg error by using setsid as per Busybox FAQ
  • Fix #491 by correctly checking Xen kernel used for a dom0 env (apollo13)
  • Improves logging in Die()
  • Improve again ProLiant HW support, by adding references to the yet to come SSSTK rpm so that conrep is called at its future right place.
  • Improve mindi support for kernel 3.x
  • Fix #499 for good, by using a real init from busybox and moving our init script to etc/init.d/rcS. We also now call the reboot from busybox to exit, which indeed reset the system correctly (in a VM at least which wasn't the case before). Reauires a new mindi-busybox as well.
  • Attempt to solve #503 by handling /lib64 separately for udev and only if not a link (to /lib) for Ubuntu 64
  • Improve again previous tests for bug #503
  • Improve -d option description for NFS
  • Allow http download for ftp content
  • New italian mirror
  • Fix #505 by documenting environment variables
    • Fix a bug where on OBDR mode compression was turned off to create the OBDR content but not back on (report from the mailing list)
  • solve http://trac.mondorescue.org/ticket/520 by Victor Gattegno
  • Fix #524 as option -U needs a size also
  • Removes useless gendf option
  • Fix #511 now stabgrub is called also after conf file modifications
  • Adds support for SUID binaries
  • remove a useless xenkernelname variable from mindi
  • Should fix #512 by clearing old scratchdir before changing to a new
  • Simplify the function engaging SCSI for Smart Array controllers, and support as many controller as we have
  • Add some binaries used on SLES 10 by udev
  • Fix a syntax issue in newt-specific.c
  • Fix a memory free bug where a used variable was freed to early
  • Fix a memory free bug where a used variable was misused in asprintf/free
  • Fix #498 by using an external program (hpsa_obdr_mode) which can set the mode of the tape to CD-ROM or Sequential at will.

That program will have to be downloaded from http://cciss.sf.net

  • Adds support for the route command in mindi-busybox
  • Force block size back to 32768 in OBDR mode after skipping the 2 tape marks, to read the additional rootfs data corerctly - Fix #498 for good it seems
  • Adds support for a new pata_atiixp driver
  • Fix #525 and improve printing when no /etc/raidtab, but still md devices
  • Exclude /run similarly to /sys and /proc
  • Fix a bug in mindi when having multiple swap partiions with same starting string (/dev/dm-1 and /dev/dm-16). We now add a space in the grep to avoid mischoice.
  • Fix grub installation if we had to go in the hack part which wasn't using the correct variables to make decisions !
  • Remove all mention of mondorescue.com from code
  • Fix some website typo on the download page and precise that we now develop on Mageia
  • Exclude sysfs devpts and tmpfs partitions found in RHEL 6.2 from analyze by mindi (made error messages)
  • Force activation of first partition which should not be optional as everything is destroyed before
  • Fix a bug in analyze-my-lvm where LVs were created in random order (the one of lvscan) instead of using the dm-xxx order, which creates issues at restore time between the mapping created then and the one we had at backup time which could be inconssistent

-mondoarchive now exists if the mt command is missing when needed

  • Proper fix for analyze-my-lvm
  • Fix #500 and #473 by adding support of old metadata format for mdadm if using grub < 0.9x or lilo on a md boot device (to be tested)
  • Really never inject or eject when the -e option is passed or device is inappropriate (USB, Net, ...)
  • Fix #577 by having factor back as a float (not a long ! it's a decimal value) and making the appropriate cast.
  • Fix #578 by improving the regexp used for CD/DVD detection with -scanbus option
  • Adds more verbosity when LVM creation fails.
  • Fix #579 by checking with pipes on both sides of the string
  • debugfs should be excluded from the device considered for fstab analysis
Location:
branches/3.1/mondo/src/mondorestore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1/mondo/src/mondorestore/mondo-prep.c

    r2816 r2937  
    1010#include "mondoprep.h"
    1111#include "../common/libmondo.h"
     12#include "../common/libmondo-tools-EXT.h"
    1213#include "mondo-rstr-tools-EXT.h"
    1314#include <sys/ioctl.h>
     
    4344
    4445FILE *g_fprep = NULL;
    45 
    46 
     46extern char *g_mondo_cfg_file;  // where m*ndo-restore.cfg (the config file) is stored
    4747
    4848int g_partition_table_locked_up = 0;
    49 
    50 
    51 
    52 
    53 
    54 
    55 
    5649
    5750
     
    323316        res = run_program_and_log_output(command, 5);
    324317        if (res > 0 && (p = strstr(command, "lvm "))) {
     318            log_msg(0, "%s --> %d failed so removing lvm just in case", command, res);
    325319            *p = *(p + 1) = *(p + 2) = ' ';
    326320            res = run_program_and_log_output(command, 5);
     
    545539  char *level   = NULL;
    546540  char *program = NULL;
     541  char *tmp = NULL;
     542  char *oldmd = NULL;
     543  char *bootdevice;
     544  char *name;
     545
     546  malloc_string(bootdevice);
     547  malloc_string(name);
    547548 
    548549  // leave straight away if raidlist is initial or has no entries
     
    589590  // - faulty devices ignored
    590591  // - persistent superblock always used as this is recommended
    591   mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries);
     592  // As per bug #473, the parameter "-e 0.90" is used only when:
     593  //   1) It detects that system boots from Raid-1
     594  //   2) grub bootloader < v1 is used.
     595  // Otherwise it won't boot which is bad.
     596    read_cfg_var(g_mondo_cfg_file, "bootloader.device", bootdevice);
     597    read_cfg_var(g_mondo_cfg_file, "bootloader.name", name);
     598    if (strcmp(name,"GRUB") == 0) {
     599        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("grub --version"));
     600        if ((strstr(tmp, "GRUB 0.9") != NULL) && (strcmp(raidlist->el[i].raid_device,device) == 0)) {
     601            mr_free(oldmd);
     602            mr_asprintf(oldmd, "-e 0.90");
     603            log_it("Forcing old metadata 0.90 for md on %s for old GRUB", device);
     604        }
     605    } else if ((strcmp(name,"LILO") == 0) && (strcmp(raidlist->el[i].raid_device,device) == 0)) {
     606        mr_free(oldmd);
     607        mr_asprintf(oldmd, "-e 0.90");
     608        log_it("Forcing old metadata 0.90 for md on %s for LILO", device);
     609    } else {
     610        mr_asprintf(oldmd, "");
     611    }
     612    mr_free(device);
     613    mr_free(name);
     614
     615  mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d %s", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries, oldmd);
     616  mr_free(oldmd);
    592617  if (raidlist->el[i].parity != -1) {
    593618    mr_asprintf(strtmp, "%s", program);
     
    22892314
    22902315    /** float ***********************************************************/
    2291     long long factor;
     2316    float factor;
    22922317    long long new_size;
    22932318
     
    23222347
    23232348    drivemntlist = malloc(sizeof(struct mountlist_reference));
    2324     drivemntlist->el =
    2325         malloc(sizeof(struct mountlist_line *) * MAX_MOUNTLIST_ENTRIES);
     2349    drivemntlist->el = malloc(sizeof(struct mountlist_line *) * MAX_MOUNTLIST_ENTRIES);
    23262350
    23272351    if (!drivemntlist) {
     
    23372361    }
    23382362
    2339     if (original_size_of_drive <= 0) {
     2363    if (original_size_of_drive <= 0LL) {
    23402364        log_to_screen("Cannot resize %s's entries. Drive not found.", drive_name);
    23412365        return;
    23422366    }
    2343     factor = (current_size_of_drive) / (original_size_of_drive);
    2344     log_to_screen("Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %lld)", drive_name, original_size_of_drive/1024, current_size_of_drive/1024, factor);
     2367    factor = ((float)current_size_of_drive/(float)original_size_of_drive);
     2368    mr_asprintf(tmp, "Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %.5f)",
     2369            drive_name, original_size_of_drive/1024, current_size_of_drive/1024, factor);
     2370    log_to_screen(tmp);
     2371    mr_free(tmp);
    23452372
    23462373    lastpart = drivemntlist->entries - 1;
     
    23482375        /* the 'atoi' thing is to make sure we don't try to resize _images_, whose formats will be numeric */
    23492376        if (!atoi(drivemntlist->el[partno]->format)) {
    2350             new_size = (drivemntlist->el[partno]->size) * factor;
     2377            new_size = (long long)((drivemntlist->el[partno]->size) * factor);
    23512378        } else {
    23522379            new_size = drivemntlist->el[partno]->size;
  • branches/3.1/mondo/src/mondorestore/mondo-rstr-newt.c

    r2816 r2937  
    18041804#undef ACOMP
    18051805
     1806        newtDrawForm(editraidForm);
    18061807        newtRefresh();
    18071808        b_res = newtRunForm(editraidForm);
  • branches/3.1/mondo/src/mondorestore/mondo-rstr-tools.c

    r2850 r2937  
    205205    return (1);
    206206}
    207 paranoid_system("umount "MNT_CDROM" 2> /dev/null"); /* just in case */
     207paranoid_system("umount -d " MNT_CDROM " 2> /dev/null");    /* just in case */
    208208
    209209if (is_this_device_mounted(g_isodir_device)) {
     
    612612        }
    613613    }
    614     run_program_and_log_output("umount "MNT_CDROM, FALSE);
     614    run_program_and_log_output("umount -d "MNT_CDROM, FALSE);
    615615    if (!does_file_exist(cfg_file)) {
    616616        log_it("%s",cfg_file);
     
    684684            if (does_file_exist(MNT_CDROM"/archives/filelist.0")) {
    685685                bkpinfo->backup_media_type = cdr;
    686                 run_program_and_log_output("umount "MNT_CDROM, 1);
     686                run_program_and_log_output("umount -d "MNT_CDROM, 1);
    687687                log_it
    688688                    ("Re-jigging configuration AGAIN. CD-R, not ISO.");
     
    14141414            if (res) {
    14151415                popup_and_OK
    1416                     ("GRUB installation failed. Please install manually using 'grub-install' or similar command. You are now chroot()'ed to your restored system. Please type 'exit' when you are done.");
    1417                 newtSuspend();
    1418                 system("chroot " MNT_RESTORING);
    1419                 newtResume();
    1420                 popup_and_OK("Thank you.");
     1416                    ("GRUB installation failed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install");
     1417                if (!g_text_mode) {
     1418                    newtSuspend();
     1419                }
     1420                sprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);
     1421                paranoid_system(tmp);
     1422                sprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor);
     1423                paranoid_system(tmp);
     1424                if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) {
     1425                    sprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor);
     1426                } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) {
     1427                    sprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor);
     1428                }
     1429                paranoid_system(tmp);
     1430                sprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor);
     1431                paranoid_system(tmp);
     1432                if (!g_text_mode) {
     1433                    newtResume();
     1434                }
     1435                sprintf(command, "stabgrub-me %s", boot_device);
     1436                res = run_program_and_log_output(command, 1);
     1437                if (res) {
     1438                    popup_and_OK
     1439                        ("GRUB installation failed. Please fix the conf files so that a manual install using 'grub-install' or similar command works. You are now chroot()'ed to your restored system. Please type 'exit' when you are done.");
     1440                    newtSuspend();
     1441                    system("chroot " MNT_RESTORING);
     1442                    newtResume();
     1443                    popup_and_OK("Thank you.");
     1444                } else {
     1445                    popup_and_OK("GRUB is now installed correctly");
     1446                    done = TRUE;
     1447                }
    14211448            } else {
    14221449                done = TRUE;
     
    19331960
    19341961    /* Unmounting the local /proc and /sys first */
    1935     run_program_and_log_output("umount " MNT_RESTORING "/proc",3);
    1936     run_program_and_log_output("umount " MNT_RESTORING "/sys",3);
     1962    run_program_and_log_output("umount -d " MNT_RESTORING "/proc",3);
     1963    run_program_and_log_output("umount -d " MNT_RESTORING "/sys",3);
    19371964
    19381965    for (lino = mountlist->entries - 1; lino >= 0; lino--) {
     
    19481975            } else {
    19491976                if (!strcmp(mountlist->el[lino].mountpoint, "/1")) {
    1950                     mr_asprintf(command, "umount %s/", MNT_RESTORING);
     1977                    mr_asprintf(command, "umount -d %s/", MNT_RESTORING);
    19511978                    log_msg(3,
    19521979                            "Well, I know a certain kitty-kitty who'll be sleeping with Mommy tonight...");
    19531980                } else {
    1954                     mr_asprintf(command, "umount " MNT_RESTORING "%s", mountlist->el[lino].mountpoint);
     1981                    mr_asprintf(command, "umount -d " MNT_RESTORING "%s", mountlist->el[lino].mountpoint);
    19551982
    19561983                    /* To support latest Ubuntu where /var is a separate FS
     
    19982025 *END_UNMOUNT_ALL_DEVICES                                                 *
    19992026 **************************************************************************/
    2000 
    2001 
    20022027
    20032028/**************************************************************************
  • branches/3.1/mondo/src/mondorestore/mondorestore.c

    r2874 r2937  
    116116
    117117/**************************************************************************
    118  * COMPAQ PROLIANT Stuff:  needs some special help                        *
     118 * COMPAQ ProLiant Stuff:  needs some special help                        *
    119119**************************************************************************/
    120120
    121121/**
    122  * The message to display if we detect that the user is using a Compaq Proliant.
     122 * The message to display if we detect that the user is using a Compaq ProLiant.
    123123 */
    124124#define COMPAQ_PROLIANTS_SUCK "Partition and format your disk using Compaq's disaster recovery CD. After you've done that, please reboot with your Mondo media in Interactive Mode."
     
    209209 * @ingroup restoreUtilityGroup
    210210 */
    211 void offer_to_abort_because_Compaq_Proliants_suck(void)
     211void offer_to_abort_because_Compaq_ProLiants_suck(void)
    212212{
    213213    popup_and_OK(COMPAQ_PROLIANTS_SUCK);
     
    256256        popup_and_OK("No restoring or comparing will take place today.");
    257257        if (is_this_device_mounted("/mnt/cdrom")) {
    258             run_program_and_log_output("umount /mnt/cdrom", FALSE);
     258            run_program_and_log_output("umount -d /mnt/cdrom", FALSE);
    259259        }
    260260        if (g_ISO_restore_mode) {
    261             mr_asprintf(tmp, "umount %s", bkpinfo->isodir);
     261            mr_asprintf(tmp, "umount -d %s", bkpinfo->isodir);
    262262            run_program_and_log_output(tmp, FALSE);
    263263            mr_free(tmp);
     
    485485                if (partition_table_contains_Compaq_diagnostic_partition
    486486                    (mountlist)) {
    487                     offer_to_abort_because_Compaq_Proliants_suck();
     487                    offer_to_abort_because_Compaq_ProLiants_suck();
    488488                    done = TRUE;
    489489                } else {
     
    693693    }
    694694    if (is_this_device_mounted(MNT_CDROM)) {
    695         paranoid_system("umount " MNT_CDROM);
     695        paranoid_system("umount -d " MNT_CDROM);
    696696    }
    697697//  if (! already_mounted)
    698698//    {
    699     if (system("umount /tmp/isodir 2> /dev/null")) {
     699    if (system("umount -d /tmp/isodir 2> /dev/null")) {
    700700        log_to_screen
    701701            ("WARNING - unable to unmount device where the ISO files are stored.");
     
    773773        if (partition_table_contains_Compaq_diagnostic_partition
    774774            (mountlist)) {
    775             offer_to_abort_because_Compaq_Proliants_suck();
     775            offer_to_abort_because_Compaq_ProLiants_suck();
    776776        } else {
    777777            twenty_seconds_til_yikes();
     
    949949                "Tape : I don't need to unmount or eject the CD-ROM.");
    950950    } else {
    951         run_program_and_log_output("umount " MNT_CDROM, FALSE);
     951        run_program_and_log_output("umount -d " MNT_CDROM, FALSE);
    952952        if (!bkpinfo->please_dont_eject) {
    953953            eject_device(bkpinfo->media_device);
    954954        }
    955955    }
    956     run_program_and_log_output("umount " MNT_CDROM, FALSE);
     956    run_program_and_log_output("umount -d " MNT_CDROM, FALSE);
    957957    if (!bkpinfo->please_dont_eject) {
    958958        eject_device(bkpinfo->media_device);
     
    21382138
    21392139        /* Now we need to umount the current media to have the next mounted by insist_on_this_cd_number */
    2140         run_program_and_log_output("umount " MNT_CDROM, FALSE);
     2140        /*   run_program_and_log_output("umount " MNT_CDROM, FALSE); */
    21412141    }
    21422142    mr_free(mds);
     
    26352635    make_hole_for_dir("/var/log");
    26362636    make_hole_for_dir("/tmp/tmpfs");    /* just in case... */
    2637     run_program_and_log_output("umount " MNT_CDROM, FALSE);
     2637    run_program_and_log_output("umount -d " MNT_CDROM, FALSE);
    26382638
    26392639    run_program_and_log_output("rm -Rf /tmp/tmpfs/mondo.tmp.*", FALSE);
     
    26692669        fout = fopen("/tmp/out.txt", "w");
    26702670        fput_string_one_char_at_a_time(stderr, argv[2]);
    2671         finish(0);
    2672     }
    2673 
    2674     if (argc == 3 && strcmp(argv[1], "--gendf") == 0) {
    2675         make_grub_install_scriptlet(argv[2]);
    26762671        finish(0);
    26772672    }
     
    28922887            sync();
    28932888            if (is_this_device_mounted(MNT_CDROM)) {
    2894                 run_program_and_log_output("umount " MNT_CDROM, FALSE);
     2889                run_program_and_log_output("umount -d " MNT_CDROM, FALSE);
    28952890            }
    28962891
     
    29502945    log_to_screen("Mondo-restore is exiting (retval=%d)                                      ", retval);
    29512946
    2952     mr_asprintf(tmp, "umount %s", bkpinfo->isodir);
     2947    mr_asprintf(tmp, "umount -d %s", bkpinfo->isodir);
    29532948    run_program_and_log_output(tmp, 5);
    29542949    mr_free(tmp);
Note: See TracChangeset for help on using the changeset viewer.