Changeset 1948 in MondoRescue for branches


Ignore:
Timestamp:
May 26, 2008, 5:35:44 PM (16 years ago)
Author:
Bruno Cornec
Message:
  • Adds OBDR support (use_obdr field in bkpinfo added, -o option changed to mean OBDR - LILO not usable anyway as a bootloader for ISO images)
Location:
branches/2.2.6
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.6/mindi/mindi

    r1944 r1948  
    10311031    AddFileToCfgIfExists $MINDI_TMP/ACL      acl      $outfile
    10321032    AddFileToCfgIfExists $MINDI_TMP/XATTR      xattr      $outfile
     1033    AddFileToCfgIfExists $MINDI_TMP/OBDR      obdr      $outfile
    10331034}
    10341035
  • branches/2.2.6/mondo-doc/mondoarchive.8

    r1885 r1948  
    209209.TP
    210210.BI "-o "
    211 Use LILO as boot loader of boot media instead of SYSLINUX/ISOLINUX. By
    212 default, SYSLINUX is used for USB and ISOLINUX for CD's. Use LILO if you
    213 prefer to use that boot loader. NB: This does not affect which boot loader you
    214 use to boot your PC, merely the boot loader used by the media created
    215 by Mondo. Use ELILO instead which is mandatory for IA64 machines.
     211Use OBDR (One Button Disaster Recovery) type of tapes.
     212By default, tapes are not bootable. With this flag, tape will be made bootable
     213following the OBDR format.
    216214
    217215.TP
  • branches/2.2.6/mondo/src/common/libmondo-archive.c

    r1946 r1948  
    847847        if (write_one_liner_data_file(tmp1, "TRUE")) {
    848848            log_msg(1, "%ld: Unable to write one-liner ACL",
     849                __LINE__);
     850        }
     851        paranoid_free(tmp1);
     852    }
     853    if (bkpinfo->use_obdr) {
     854        asprintf(&tmp1, "%s/OBDR", bkpinfo->tmpdir);
     855        if (write_one_liner_data_file(tmp1, "TRUE")) {
     856            log_msg(1, "%ld: Unable to write one-liner OBDR",
    849857                __LINE__);
    850858        }
  • branches/2.2.6/mondo/src/common/libmondo-cli.c

    r1945 r1948  
    934934    }
    935935
    936     if (!flag_set['o']
    937         &&
    938         !run_program_and_log_output
    939         ("grep -Ei suse /etc/issue.net | grep -E '9.0' | grep 64", 2)) {
     936    bkpinfo->use_obdr = FALSE;
     937    if (flag_set['o']) {
     938        if (!flag_set['t']) {
     939            log_to_screen("OBDR support is only available for tapes. Use the -t option");
     940            fatal_error("Aborting");
     941        }
     942        bkpinfo->use_obdr = TRUE;
     943    }
     944#ifndef __FreeBSD__
     945    if (!is_this_a_valid_disk_format("vfat")) {
    940946        bkpinfo->make_cd_use_lilo = TRUE;
    941947        log_to_screen
    942             ("Forcing you to use LILO. SuSE 9.0 (64-bit) has a broken mkfs.vfat binary.");
    943     }
    944     if (flag_set['o']) {
     948            ("Your kernel appears not to support vfat filesystems. I am therefore");
     949        log_to_screen
     950            ("using LILO instead of SYSLINUX as the media boot loader.");
     951    }
     952    if (run_program_and_log_output("which mkfs.vfat", 2)) {
    945953        bkpinfo->make_cd_use_lilo = TRUE;
    946     }
    947 #ifndef __FreeBSD__
    948     else {
    949         if (!is_this_a_valid_disk_format("vfat")) {
    950             bkpinfo->make_cd_use_lilo = TRUE;
    951             log_to_screen
    952                 ("Your kernel appears not to support vfat filesystems. I am therefore");
    953             log_to_screen
    954                 ("using LILO instead of SYSLINUX as the media boot loader.");
    955         }
    956         if (run_program_and_log_output("which mkfs.vfat", 2)) {
    957             bkpinfo->make_cd_use_lilo = TRUE;
    958954#ifdef __IA32__
    959             log_to_screen
    960                 ("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as");
    961             log_to_screen
    962                 ("your boot loader. I shall therefore use LILO instead.");
     955        log_to_screen
     956            ("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as");
     957        log_to_screen
     958            ("your boot loader. I shall therefore use LILO instead.");
    963959#endif
    964960#ifdef __IA64__
    965             log_to_screen
    966                 ("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI");
    967             log_to_screen("environment correctly. Please install it.");
    968             fatal_error("Aborting");
     961        log_to_screen
     962            ("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI");
     963        log_to_screen("environment correctly. Please install it.");
     964        fatal_error("Aborting");
    969965#endif
    970         }
     966    }
    971967#ifdef __IA64__
    972         /* We force ELILO usage on IA64 */
    973         bkpinfo->make_cd_use_lilo = TRUE;
     968    /* We force ELILO usage on IA64 */
     969    bkpinfo->make_cd_use_lilo = TRUE;
    974970#endif
    975     }
    976971#endif
    977972
  • branches/2.2.6/mondo/src/common/libmondo-stream.c

    r1943 r1948  
    44...tools for talking to tapes, Monitas streams, etc.
    55
    6 
    7 07/10
    8 - added ACL and XATTR support
    9 
    10 04/17
    11 - added bkpinfo->internal_tape_block_size
    12 - fixed bug in set_tape_block_size_with_mt()
    13 
    14 03/25
    15 - call 'mt' when opening tape in/out, to set block size to 32K
    16 
    17 02/06/2004
    18 - only eject_device() at end of closein_tape() --- not closeout_tape()
    19 
    20 10/26/2003
    21 - call eject_device() at end of closein_tape() and closeout_tape()
    22  
    23 09/25
    24 - added docu-header to each subroutine
    25 
    26 09/20
    27 - working on multi-tape code
    28 - friendlier message in insist_on_this_tape_number()
    29 - delay is now 5s
    30 
    31 09/10
    32 - adding multi-tape support
    33 - adding 'back catalog' of previous archives, so that we may resume
    34   from point of end-of-tape (approx.)
    35 
    36 09/08
    37 - cleaned up insist_on_this_tape_number() --- 10s delay for same tape now
    38 
    39 08/27
    40 - improved find_tape_device_and_size() --- tries /dev/osst*
    41 
    42 05/05
    43 - added Joshua Oreman's FreeBSD patches
    44 
    45 04/24
    46 - added lots of assert()'s and log_OS_error()'s
    47 
    48 04/06/2003
    49 - use find_home_of_exe() instead of which
    50 
    51 12/13/2002
    52 - cdrecord -scanbus call was missing 2> /dev/null
    53 
    54 11/24
    55 - disabled fatal_error("Bad marker")
    56 
    57 10/29
    58 - replaced convoluted grep wih wc (KP)
    59 
    60 09/07
    61 - removed g_end_of_tape_reached
    62 - lots of multitape-related fixes
    63 
    64 08/01 - 08/31
    65 - write 16MB of zeroes to end of tape when closing(out)
    66 - compensate for 'buffer' and its distortion of speed of writing/reading
    67   when writing/reading data disks at start of tape
    68 - rewrote lots of multitape stuff
    69 - wrote workaround to allow >2GB of archives w/buffering
    70 - do not close/reopen tape when starting to read/write from
    71   new tape: no need! 'buffer' handles all that; we're writing
    72   to/reading from a FIFO, so no need to close/reopen when new tape
    73 - write 8MB of zeroes at end of tape, just in case
    74 - re-enable various calls to *_evalcall_form
    75 - added g_end_of_tape_reached
    76 - fixed bugs in start_to_[read|write]_[to|from]_next_tape
    77 - added internal buffering, replacing the external 'buffer' exe
    78 - wait 10 seconds (after user inserts new tape), to
    79   let tape stabilize in drive
    80 - added insist_on_this_tape_number()
    81 - worked on find_tape_device_and_size()
    82 - cleaned up some log_it() calls
    83 - added find_tape_device_and_size()
    84 - replaced using_cdstream with backup_media_type
    85 - replace *_from_tape with *_from_stream
    86 - replace *_to_stream with *_to_stream
    87 
    88 07/01 - 07/31
    89 - leave 32MB at end of tape, to avoid overrunning
    90 - started [07/24/2002]
    916*/
    927
     
    753668        return (0);
    754669    }
     670    if (bkpinfo->use_obdr) {
     671        skip_obdr(tapedev);
     672    }
     673
    755674    insist_on_this_tape_number(1);
    756675    sprintf(outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir);
     
    864783
    865784/**
    866  * Start writing to a tape device for the backup.
     785 * Return the non-rewinding device when passed the normal one
     786 * @param tapedev The tape device to open for writing.
     787 * @note the caller needs to free the string returned
     788 */
     789char *get_non_rewind_dev(char *tapedev)
     790{
     791
     792    char *ntapedev = NULL;
     793    char *p = NULL;
     794    char *q = NULL;
     795
     796    ntapedev = (char *)malloc(strlen(tapedev)+sizeof(char));
     797    p = strrchr(tapedev,'/');
     798    if (p == NULL) {
     799        return(NULL);
     800    }
     801
     802    /* Copy tapedev content up to the last / */
     803    q = tapedev;
     804    while (q != p) {
     805        *ntapedev = *q;
     806        ntapedev++;
     807        q++;
     808    }
     809    /* Copy the '/' */
     810    *ntapedev = *q;
     811    ntapedev++;
     812    q++;
     813    /* Adds a 'n' - non-rewinding */
     814    *ntapedev = 'n';
     815    ntapedev++;
     816    /* Copy the rest of tapedev */
     817    while (*q != '\0') {
     818        *ntapedev = *q;
     819        ntapedev++;
     820        q++;
     821    }
     822    *ntapedev = '\0';
     823    if (mt_says_tape_exists(ntapedev)) {
     824        log_it("Non-rewinding tape device is %s",ntapedev);
     825    } else {
     826        log_it("Unable to find non-rewinding tape device.");
     827        ntapedev = NULL;
     828    }
     829    return(ntapedev);
     830}
     831
     832
     833/**
     834 * Handle OBDR if we were asked to do so
    867835 * @param tapedev The tape device to open for writing.
    868836 * @return 0 for success, nonzero for failure.
     
    870838 * EXISTING DATA on the tape!
    871839 */
     840void skip_obdr(char *tapedev)
     841{
     842    char *command = NULL;
     843
     844    ntapedev = get_non_rewind_dev(tapedev);
     845    if (ntapedev == NULL) {
     846        log_it("Not skipping OBDR");
     847    }
     848
     849    asprintf(&command, "mt -f %s fsf 2", ntapedev);
     850    run_program_and_log_output(command, 1);
     851    paranoid_free(command);
     852}
     853
     854int create_obdr(char *tapedev)
     855{
     856
     857    char *ntapedev = NULL;
     858    char *command = NULL;
     859    int res = 0;
     860
     861    ntapedev = get_non_rewind_dev(tapedev);
     862    if (ntapedev == NULL) {
     863        log_it("Skipping OBDR");
     864        return(1);
     865    }
     866
     867    /* OBDR: First block 10 kB of zero bs = 512 */
     868    asprintf(&command, "mt -f %s compression off", tapedev);
     869    res = run_program_and_log_output(command, 1);
     870    paranoid_free(command);
     871
     872    asprintf(&command, "mt -f %s rewind", tapedev);
     873    res = run_program_and_log_output(command, 1);
     874    paranoid_free(command);
     875
     876    asprintf(&command, "mt -f %s setblk 512", ntapedev);
     877    res = run_program_and_log_output(command, 1);
     878    paranoid_free(command);
     879
     880    asprintf(&command, "dd if=/dev/zero of=%s bs=512 count=20", ntapedev);
     881    res = run_program_and_log_output(command, 1);
     882    paranoid_free(command);
     883
     884    /* OBDR: then ISO boot image bs = 2048 */
     885    asprintf(&command, "mt -f %s setblk 2048", ntapedev);
     886    res = run_program_and_log_output(command, 1);
     887    paranoid_free(command);
     888
     889    asprintf(&command, "dd if=%s of=%s bs=2048", ntapedev);
     890    res = run_program_and_log_output(command, 1);
     891    paranoid_free(command);
     892
     893}
     894
     895/**
     896 * Start writing to a tape device for the backup.
     897 * Handle OBDR if we were asked to do so
     898 * @param tapedev The tape device to open for writing.
     899 * @return 0 for success, nonzero for failure.
     900 * @note This should be called ONLY from backup processes. It will OVERWRITE ANY
     901 * EXISTING DATA on the tape!
     902 */
    872903int openout_tape(char *tapedev, long internal_tape_block_size)
    873904{
    874 //  char sz_call_to_buffer[MAX_STR_LEN];
    875905
    876906    g_current_media_number = 1;
     
    884914    g_tapecatalog->entries = 0;
    885915    g_tape_posK = 0;
     916
     917    if (bkpindo->use_obdr) {
     918        create_obdr(tapedev);
     919    }
    886920
    887921    set_tape_block_size_with_mt(tapedev, internal_tape_block_size);
  • branches/2.2.6/mondo/src/common/mondostructures.h

    r1899 r1948  
    606606   */
    607607    bool make_cd_use_lilo;
     608
     609  /**
     610   * If TRUE, make the the tape bootable. If FALSE, normal tape, the default
     611   */
     612    bool use_obdr;
    608613};
    609614
  • branches/2.2.6/mondo/src/mondorestore/mondo-rstr-tools.c

    r1937 r1948  
    10411041read_cfg_var(cfg_file, "use-star", value);
    10421042if (strstr(value, "yes")) {
    1043 bkpinfo->use_star = TRUE;
    1044 log_msg(1, "Goody! ... bkpinfo->use_star is now true.");
     1043    bkpinfo->use_star = TRUE;
     1044    log_msg(1, "Goody! ... bkpinfo->use_star is now true.");
     1045}
     1046
     1047read_cfg_var(cfg_file, "obdr", value);
     1048if (strstr(value, "TRUE")) {
     1049    bkpinfo->use_obdr = TRUE;
     1050    log_msg(1, "OBDR mode activated");
    10451051}
    10461052
    10471053read_cfg_var(cfg_file, "acl", value);
    10481054if (strstr(value, "TRUE")) {
    1049 asprintf(&g_getfacl,"setfacl");
    1050 log_msg(1, "We will restore ACLs");
    1051 if (! find_home_of_exe("setfacl")) {
    1052     log_msg(1, "Unable to restore ACLs as no setfacl found");
    1053 }
     1055    asprintf(&g_getfacl,"setfacl");
     1056    log_msg(1, "We will restore ACLs");
     1057    if (! find_home_of_exe("setfacl")) {
     1058        log_msg(1, "Unable to restore ACLs as no setfacl found");
     1059    }
    10541060}
    10551061read_cfg_var(cfg_file, "xattr", value);
    10561062if (strstr(value, "TRUE")) {
    1057 asprintf(&g_getfattr,"setfattr");
    1058 log_msg(1, "We will restore XATTRs");
    1059 if (! find_home_of_exe("setfattr")) {
    1060     log_msg(1, "Unable to restore XATTRs as no setfattr found");
    1061 }
     1063    asprintf(&g_getfattr,"setfattr");
     1064    log_msg(1, "We will restore XATTRs");
     1065    if (! find_home_of_exe("setfattr")) {
     1066        log_msg(1, "Unable to restore XATTRs as no setfattr found");
     1067    }
    10621068}
    10631069
Note: See TracChangeset for help on using the changeset viewer.