Changeset 2052 in MondoRescue
- Timestamp:
- Oct 23, 2008, 2:55:59 PM (15 years ago)
- Location:
- branches/2.2.8
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.8/mindi/mindi
r2051 r2052 57 57 CDROM_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" 58 58 # Those modules will only go on the backup media, not the boot media. 59 EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid5 raid456 lvm-mod dm-mod dm_mod dm-snapshot dm_snapshot dm-zero dm_zero dm-mirror dm_mirror dm _multipath dm-multipath dm-round-robin dm_round_robin jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd mbcache"59 EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid5 raid456 lvm-mod dm-mod dm_mod dm-snapshot dm_snapshot dm-zero dm_zero dm-mirror dm_mirror dm-multipath dm_multipath dm-round-robin dm_round_robin jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd mbcache" 60 60 # Replace with that line for HP OCMP e.g. 61 61 #DENY_MODS="MPS_Driver_Mapper mps octtldrv tscttl streams kqemu" -
branches/2.2.8/mondo/src/common/libmondo-devices.c
r2050 r2052 1017 1017 log_msg(1, "Failed to get harddisk geometry, using old mode"); 1018 1018 } 1019 /*1020 if ((fd = open (drive, O_RDONLY)) != -1) {1021 if (ioctl (fd, HDIO_GETGEO, &hdgeo) != -1) {1022 close (fd);1023 log_msg (2, "Geometry of drive %s is C:%d, H:%d, S%d, its size is %d MB", drive, hdgeo.cylinders, hdgeo.heads, hdgeo.sectors, (hdgeo.cylinders * hdgeo.heads * hdgeo.sectors / 2 / 1024));1024 if ( hdgeo.cylinders && hdgeo.heads && hdgeo.sectors ) {1025 outvalB = ((long) (hdgeo.cylinders * hdgeo.heads * hdgeo.sectors / 2 / 1024));1026 }1027 }1028 close (fd);1029 */1030 1019 #endif 1031 1020 } … … 1042 1031 return (outvalC); 1043 1032 } 1044 1045 /* The old version */1046 #if 01047 long get_phys_size_of_drive(char *drive)1048 {1049 /*@ pointers **************************************************** */1050 #if linux1051 FILE *fin;1052 char *p;1053 char *q;1054 char *r;1055 /*@ buffers ***************************************************** */1056 char *tmp;1057 char *command;1058 1059 /*@ long ******************************************************** */1060 long outL;1061 long tempLa;1062 long tempLb;1063 long tempLc;1064 1065 #endif1066 1067 struct hd_geometry hdgeo;1068 int fd;1069 1070 #ifdef __FreeBSD__1071 off_t o;1072 1073 if ((fd = open(drive, O_RDONLY)) != -1) {1074 if (ioctl(fd, DIOCGMEDIASIZE, &o) != -1) {1075 close(fd);1076 return (long) (o / (off_t) (1024 * 1024));1077 }1078 close(fd);1079 }1080 log_msg(4, "drive = %s, error = %s", drive, strerror(errno));1081 fatal_error("GPSOD: Unable to get size of drive");1082 #else1083 1084 malloc_string(tmp);1085 malloc_string(command);1086 1087 if ((fd = open(drive, O_RDONLY)) != -1) {1088 if (ioctl(fd, HDIO_GETGEO, &hdgeo) != -1) {1089 close(fd);1090 log_msg(2,1091 "Geometry of drive %s is C:%d, H:%d, S%d, its size is %d MB",1092 drive, hdgeo.cylinders, hdgeo.heads, hdgeo.sectors,1093 (hdgeo.cylinders * hdgeo.heads * hdgeo.sectors / 2 /1094 1024));1095 if (hdgeo.cylinders && hdgeo.heads && hdgeo.sectors) {1096 return ((long)1097 (hdgeo.cylinders * hdgeo.heads * hdgeo.sectors /1098 2 / 1024));1099 }1100 }1101 close(fd);1102 }1103 1104 assert_string_is_neither_NULL_nor_zerolength(drive);1105 1106 sprintf(command,1107 "parted2fdisk -l %s | head -n4 | tr -s '\n' '\t' | tr -s ' ' '\t' | cut -f8,14,16",1108 drive);1109 strcpy(tmp, call_program_and_get_last_line_of_output(command));1110 if (tmp[0]) {1111 p = tmp;1112 q = strchr(p, ' ');1113 if (q) {1114 *(q++) = '\0';1115 r = strchr(q, ' ');1116 if (r) {1117 *(r++) = '\0';1118 tempLa = atol(p);1119 tempLb = atol(q);1120 tempLc = atol(r);1121 outL = tempLa * tempLb / 1024 * tempLc / 1024;1122 if (outL > 100) {1123 paranoid_free(tmp);1124 paranoid_free(command);1125 return (outL);1126 }1127 }1128 }1129 }1130 1131 /* try to grep for 'Drive xxxx: yyy MB' */1132 sprintf(command,1133 "parted2fdisk -l %s | grep MB | tr -s ' ' '\t' | cut -f3",1134 drive);1135 strcpy(tmp, call_program_and_get_last_line_of_output(command));1136 if (atol(tmp) > 0) {1137 paranoid_free(tmp);1138 paranoid_free(command);1139 return (atol(tmp));1140 }1141 1142 /* else, do it the old-fashioned way */1143 p = strrchr(drive, (int) '/');1144 if (p) {1145 strcpy(tmp, p + 1);1146 } else {1147 paranoid_free(tmp);1148 paranoid_free(command);1149 return (-1);1150 }1151 sprintf(command, "dmesg | grep %s 2> /dev/null", tmp);1152 if (!(fin = popen(command, "r"))) {1153 log_OS_error("Cannot popen dmesg command");1154 } else {1155 fgets(tmp, MAX_STR_LEN - 1, fin);1156 while (!feof(fin) && !strstr(tmp, "GB") && !strstr(tmp, "MB")) {1157 fgets(tmp, MAX_STR_LEN - 1, fin);1158 }1159 if (pclose(fin)) {1160 log_OS_error("Cannot pclose dmesg fin");1161 }1162 }1163 if (!(p = strstr(tmp, "GB")) && !(p = strstr(tmp, "MB"))) {1164 log_msg(3, "Cannot find %s's size: dmesg isn't helping either.",1165 drive);1166 paranoid_free(tmp);1167 paranoid_free(command);1168 return (-1);1169 }1170 for (; !isdigit(*(p - 1)); p--);1171 *p = '\0';1172 for (p--; isdigit(*(p - 1)); p--);1173 outL = atol(p);1174 if (outL <= 0) {1175 paranoid_free(tmp);1176 paranoid_free(command);1177 return (-1);1178 }1179 if (strstr(tmp, "GB")) {1180 outL = outL * 1024;1181 }1182 paranoid_free(tmp);1183 paranoid_free(command);1184 return (outL * 19 / 20);1185 #endif1186 }1187 #endif /* 0 */1188 1189 1190 1191 1192 1033 1193 1034 /** -
branches/2.2.8/mondo/src/common/libmondo-mountlist.c
r1909 r2052 1 /* libmondo-mountlist.csubroutines for handling mountlist1 /* subroutines for handling mountlist 2 2 $Id$ 3 4 5 6 08/017 - when evaluating mountlist, skip drive entirely if it does not exist8 9 07/1410 - always exclude /devpts, /proc, /sys from mountlist11 12 06/29/200413 - changed some char[] to *char14 - drivelist is struct now, not char[][]15 16 10/19/200317 - format_device() --- contract /dev/md/N to /dev/mdN to18 overcome devfs problems19 20 06/1121 - added support for 5th column in mountlist.txt, for labels22 23 05/0824 - added save_mountlist_to_disk() and load_mountlist()25 and misc other funcs from mondorestore.c26 27 05/0528 - added Joshua Oreman's FreeBSD patches29 30 04/2431 - added some assert()'s32 33 04/2334 - cleaned up evaluate_drive_within_mountlist() a bit35 36 01/15/200337 - added code for LVM (Brian Borgeson)38 39 10/19/200240 - added some comments41 42 07/24/200243 - created44 3 */ 45 4 … … 786 745 } 787 746 788 /*789 for (i = strlen (drive); isdigit (drive[i - 1]); i--);790 drive[i] = '\0';791 if (get_phys_size_of_drive (drive) <= 0 && drive[i - 1] == 'p')792 {793 i--;794 drive[i] = '\0';795 }796 for (j = 0; j < noof_drives && strcmp (drivelist[j], drive) != 0; j++);797 */798 799 747 sprintf(tmp, 800 748 "Putting %s with size %lli in list of drives", -
branches/2.2.8/mondo/src/common/libmondo-string.c
r1687 r2052 862 862 return partition; 863 863 } 864 /* then see if it's a dm style device */ 865 if (c && strncmp(c, "/dm-", 5) == 0) { 866 /* yup it's dm, return the full path */ 867 return partition; 868 } 864 869 865 870 for (i = strlen(partition); isdigit(partition[i - 1]); i--) -
branches/2.2.8/mondo/src/mondorestore/mondo-prep.c
r2037 r2052 1 1 /*************************************************************************** 2 mondo-prep.c - description 3 ----------------- 4 5 begin: Fri Apr 19 16:40:35 EDT 2002 6 copyright : (C) 2002 Mondo Hugo Rabson 7 email : Hugo Rabson <hugorabson@msn.com> 8 edited by : by Stan Benoit 4/2002 9 email : troff@nakedsoul.org 10 cvsid : $Id$ 2 $Id$ 11 3 ***************************************************************************/ 12 4 … … 19 11 * * 20 12 ***************************************************************************/ 21 22 /* mondo-prep.c Hugo Rabson23 24 25 26 07/2027 - when starting RAID, don't do it twice :)28 - moved Joshua's new get_phys_size_of_drive() code29 from resize_drive... into get_phys_size_of_drive()30 31 06/2932 - make sure software RAID devices are formatted IF user says they're to be33 - drivelist is struct now, not char[][]34 35 06/2636 - drop make_relevant_partition_bootable(); do it yourself in C (mostly)37 - offer to reboot if partition table is locked up by the kernel38 39 06/2240 - be sure not to resize non-NTFS images when restoring41 - set non-NTFS images' partition types properly42 43 06/1944 - shut down all LVMs and VGs before prepping45 46 05/0747 - usage of parted2fdisk instead of fdisk alone (ia32/ia64 compatibility)48 BCO49 50 03/3151 - rewrote partitioning and formatting code to call fdisk once per disk52 53 10/21/200354 - suspend/resume Newt gui before/after calling do_my_funky_lvm_stuff()55 56 10/2057 - rewrote format_everything() - what a mess it was.58 It now does things in three phases:-59 - formats software RAID devices (/dev/md0, etc.)60 - formats and configures LVM devices61 - formats regular partitions (/dev/hda1, /dev/sdb2, etc.)62 and any LVMs recently prepped63 64 10/0765 - use strstr(format, "raid") instead of strcmp(format,"raid") to determin66 if partition is a RAID component67 68 09/2369 - better comments70 71 09/1872 - better logging of RAID activity73 74 05/0575 - added Joshua Oreman's FreeBSD patches76 77 04/3078 - added textonly mode79 80 04/2481 - added lots of assert()'s and log_OS_error()'s82 83 04/2184 - format_everything() --- don't let bar go too far85 - mkfs -c to check for bad blocks when formatting86 87 04/0488 - misc clean-up (Tom Mortell)89 90 01/15/200391 - added code for LVM and SW Raid (Brian Borgeson)92 93 12/10/200294 - line 1238: friendlier output95 96 11/2097 - when wiping a given device in preparation for partitioning + formatting98 it, don't wipe the MBR; just the partition table. That allows for99 stupid-ass Compaq users who like to play with their MBR's.100 - disable mountlist.txt-->mountlist.txt.pre-resize copying (superfluous)101 102 09/09103 - run_program_and_log_output() now takes boolean operator to specify104 whether it will log its activities in the event of _success_105 106 07/01 - 07/31107 - added hooks to libmondo108 - RAID enhancements (Philippe de Muyter)109 110 01/01 - 03/31111 - partition_device() will refuse to partition /dev/mdX now (cos it's a112 virtual drive); however, it will return 0 (i.e. not an error)113 - make_list_of_drives() will exclude /dev/md* from list114 - mkreiserfs -ff instead of -q (Andy Glass)115 - don't resize drive if drive not found (or if its size cannot be det'd)116 - when generating list of drives from mountlist, skip the 'p' at the end117 of drive name if /dev/ida/ or /dev/cciss/; just do it (Michael Eisenberg)118 - don't specify journal size when formatting ext3119 (used to have -Jsize=10 in the call to mkfs)120 - handles files >2GB in size121 - format interactively, if Interactive Mode122 - removed reference to g_tape_size123 - when executing /tmp/i-want-my-lvm, only record the error# if the command124 was _not_ an 'insmod' command125 - pass partition size to fdisk in Kilobytes now, not Megabytes126 - log fdisk's output to /tmp/mondo-restore.log if it fails127 - don't try to format partitions of type 'image'128 - don't type to set types of 'image' partitions129 - if format code is 1 or 2 chars then assume it is a hex string130 - took out all '/ /' comments131 - don't extrapolate/add partition from RAID dev to mountlist if it's already132 present in mountlist133 - less repetitive logging in the event of vacuum-packing of last part'n134 - no extrapolation at all: RAID partitions should be listed in mountlist135 already, thanks to either Mindi v0.5x or the mountlist editor itself136 - no longer say, 'and logging to...' when setting a partition's type137 - don't run mkfs on RAID partitions (/dev/hd*, /dev/sd*); just set type138 - the setting of a partition's type now takes place in a separate subroutine139 from the subroutine that actually creates the partition140 - no need to set type if 83: 83 is the default (under fdisk)141 - turned on '-Wall'; cleaned up some cruft142 - if vacuum-packing partition (i.e. size=0MB --> max) then say, "(maximum)"143 not, "(0 MB)"144 145 11/22/2001146 - preliminary code review147 - created on Nov 22nd, 2001148 */149 13 150 14 /**
Note:
See TracChangeset
for help on using the changeset viewer.