Changeset 3185 in MondoRescue for branches/3.0/mondo/src/mondorestore/mondo-prep.c
- Timestamp:
- Sep 20, 2013, 2:29:57 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mondo/src/mondorestore/mondo-prep.c
r3071 r3185 335 335 log_it("%s... so I'll get creative.", tmp); 336 336 if (lvmversion == 2) { 337 mr_asprintf( &tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE);337 mr_asprintf(tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE); 338 338 strcpy(tmp, call_program_and_get_last_line_of_output(tmp1)); 339 339 free(tmp1); 340 340 } else { 341 mr_asprintf( &tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE);341 mr_asprintf(tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE); 342 342 strcpy(tmp, call_program_and_get_last_line_of_output(tmp1)); 343 343 free(tmp1); … … 586 586 // create device list from normal disks followed by spare ones 587 587 if (raidlist->el[i].data_disks.el[0].device != NULL) { 588 mr_asprintf( &devices, "%s", raidlist->el[i].data_disks.el[0].device);588 mr_asprintf(devices, "%s", raidlist->el[i].data_disks.el[0].device); 589 589 log_msg(4, "Adding device %s to list", raidlist->el[i].data_disks.el[0].device); 590 590 } else { … … 602 602 // translate RAID level 603 603 if (raidlist->el[i].raid_level == -2) { 604 mr_asprintf( &level, "multipath");604 mr_asprintf(level, "multipath"); 605 605 } else if (raidlist->el[i].raid_level == -1) { 606 mr_asprintf( &level, "linear");606 mr_asprintf(level, "linear"); 607 607 } else { 608 mr_asprintf( &level, "raid%d", raidlist->el[i].raid_level);608 mr_asprintf(level, "raid%d", raidlist->el[i].raid_level); 609 609 } 610 610 // create RAID device: … … 614 614 // - persistent superblock always used as this is recommended 615 615 616 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);616 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); 617 617 mr_free(level); 618 618 log_msg(4, "cmd built: %s", program); … … 718 718 719 719 if (strstr(format, "raid")) { // do not form RAID disks; do it to /dev/md* instead 720 mr_asprintf( &tmp, "Not formatting %s (it is a RAID disk)", device);720 mr_asprintf(tmp, "Not formatting %s (it is a RAID disk)", device); 721 721 log_it(tmp); 722 722 paranoid_free(tmp); … … 733 733 #endif 734 734 if (strlen(format) <= 2) { 735 mr_asprintf( &tmp, "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format);735 mr_asprintf(tmp, "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format); 736 736 log_it(tmp); 737 737 paranoid_free(tmp); … … 740 740 } 741 741 if (is_this_device_mounted(device)) { 742 mr_asprintf( &tmp, "%s is mounted - cannot format it ", device);742 mr_asprintf(tmp, "%s is mounted - cannot format it ", device); 743 743 log_to_screen(tmp); 744 744 paranoid_free(tmp); … … 771 771 char line[MAX_STR_LEN]; 772 772 773 mr_asprintf( &tmp, "Initializing Vinum device %s (this may take a *long* time)", device);773 mr_asprintf(tmp, "Initializing Vinum device %s (this may take a *long* time)", device); 774 774 log_to_screen(tmp); 775 775 paranoid_free(tmp); … … 789 789 *(strchr(line, '\n')) = '\0'; // get rid of the \n on the end 790 790 791 mr_asprintf( &tmp, "Initializing plex: %s", line);791 mr_asprintf(tmp, "Initializing plex: %s", line); 792 792 open_evalcall_form(tmp); 793 793 paranoid_free(tmp); 794 794 795 mr_asprintf( &tmp, "vinum init %s", line);795 mr_asprintf(tmp, "vinum init %s", line); 796 796 paranoid_system(tmp); 797 797 paranoid_free(tmp); 798 798 799 799 while (1) { 800 mr_asprintf( &tmp, "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'", line);800 mr_asprintf(tmp, "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'", line); 801 801 FILE *pin = popen(tmp, "r"); 802 802 paranoid_free(tmp); … … 820 820 } 821 821 #else 822 mr_asprintf( &tmp, "Initializing RAID device %s", device);822 mr_asprintf(tmp, "Initializing RAID device %s", device); 823 823 log_to_screen(tmp); 824 824 paranoid_free(tmp); … … 871 871 } 872 872 res = which_format_command_do_i_need(format, program); 873 mr_asprintf( &tmp, "%s %s", program, device);873 mr_asprintf(tmp, "%s %s", program, device); 874 874 if (strstr(program, "kludge")) { 875 875 mr_strcat(tmp, " /"); … … 878 878 paranoid_free(tmp); 879 879 880 mr_asprintf( &tmp, "Formatting %s as %s", device, format);880 mr_asprintf(tmp, "Formatting %s as %s", device, format); 881 881 update_progress_form(tmp); 882 882 paranoid_free(tmp); … … 892 892 893 893 if (res && strstr(program, "kludge")) { 894 mr_asprintf( &tmp, "Kludge failed; using regular mkfs.%s to format %s",894 mr_asprintf(tmp, "Kludge failed; using regular mkfs.%s to format %s", 895 895 format, device); 896 896 #ifdef __FreeBSD__ … … 1705 1705 paranoid_system(tmp); 1706 1706 // mark relevant partition as bootable 1707 mr_asprintf( &tmp1,"make-me-bootable /tmp/mountlist.txt %s",drivename);1707 mr_asprintf(tmp1,"make-me-bootable /tmp/mountlist.txt %s",drivename); 1708 1708 call_program_and_get_last_line_of_output(tmp1); 1709 1709 mr_free(tmp1); … … 1817 1817 /* BERLIOS: should not be called each time */ 1818 1818 part_table_fmt = which_partition_format(drive); 1819 mr_asprintf( &output, "");1819 mr_asprintf(output, ""); 1820 1820 /* make it a primary/extended/logical */ 1821 1821 if (partno <= 4) { … … 2169 2169 fput_string_one_char_at_a_time(pout_to_fdisk, "p\n"); 2170 2170 } else { 2171 mr_asprintf( &output, "t\n%d\n%s\nw\n", partno, partcode);2171 mr_asprintf(output, "t\n%d\n%s\nw\n", partno, partcode); 2172 2172 sprintf(command, "parted2fdisk %s >> %s 2>> %s", drive, 2173 2173 MONDO_LOGFILE, MONDO_LOGFILE); … … 2519 2519 return; 2520 2520 } 2521 mr_asprintf( &tmp, "Expanding entries to suit drive %s (%lld MB)", drive_name, current_size_of_drive / 1024);2521 mr_asprintf(tmp, "Expanding entries to suit drive %s (%lld MB)", drive_name, current_size_of_drive / 1024); 2522 2522 log_to_screen(tmp); 2523 2523 mr_free(tmp); … … 2539 2539 2540 2540 if (original_size_of_drive <= 0LL) { 2541 mr_asprintf( &tmp, "Cannot resize %s's entries. Drive not found.", drive_name);2541 mr_asprintf(tmp, "Cannot resize %s's entries. Drive not found.", drive_name); 2542 2542 log_to_screen(tmp); 2543 2543 mr_free(tmp); … … 2545 2545 } 2546 2546 factor = ((float)current_size_of_drive/(float)original_size_of_drive); 2547 mr_asprintf( &tmp, "Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %.5f)",2547 mr_asprintf(tmp, "Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %.5f)", 2548 2548 drive_name, original_size_of_drive/1024, current_size_of_drive/1024, factor); 2549 2549 log_to_screen(tmp); … … 2572 2572 totalsizL += newsizL; 2573 2573 2574 mr_asprintf( &tmp, "Changing %s from %lld KB to %lld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL);2574 mr_asprintf(tmp, "Changing %s from %lld KB to %lld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL); 2575 2575 log_to_screen(tmp); 2576 2576 mr_free(tmp); … … 2579 2579 // Ensures over-allocation alert and prompt for interactive mode does not happen 2580 2580 if (totalsizL > current_size_of_drive) { 2581 mr_asprintf( &tmp, "Last partition size calculated would be over-allocated, reducing %s from %lld KB to %lld KB.", drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size - (totalsizL - current_size_of_drive));2581 mr_asprintf(tmp, "Last partition size calculated would be over-allocated, reducing %s from %lld KB to %lld KB.", drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size - (totalsizL - current_size_of_drive)); 2582 2582 drivemntlist->el[drivemntlist->entries-1]->size -= (totalsizL - current_size_of_drive); 2583 2583 } else if (totalsizL < current_size_of_drive) { 2584 mr_asprintf( &tmp, "Last partition size calculated would be under-allocated, increasing %s from %lld KB to %lld KB.",drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size + (current_size_of_drive - totalsizL));2584 mr_asprintf(tmp, "Last partition size calculated would be under-allocated, increasing %s from %lld KB to %lld KB.",drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size + (current_size_of_drive - totalsizL)); 2585 2585 drivemntlist->el[drivemntlist->entries-1]->size += (current_size_of_drive - totalsizL); 2586 2586 } 2587 2587 log_to_screen(tmp); 2588 2588 mr_free(tmp); 2589 mr_asprintf( &tmp, "final_size = %lld MB", current_size_of_drive / 1024);2589 mr_asprintf(tmp, "final_size = %lld MB", current_size_of_drive / 1024); 2590 2590 log_to_screen(tmp); 2591 2591 mr_free(tmp);
Note:
See TracChangeset
for help on using the changeset viewer.