Package: mondo
Version: 2.04-4
Severity: important

mondo is using raidtools2 that is not available in sarge.

the enclosed patch will restore a LVM on RAID as configured with sarge's
debian-installer. i doubt it can do more :(, but, hey!, that can be
enough ;)

hope this will help mondo work with sarge !

cheers,
guillaume pernot

-- Package-specific info:
/var/log/mindi.log and /var/log/mondo-archive.log not included as per user 
request.


=========================================================
Fileystem information not included as per user request.

-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.4.28-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages mondo depends on:
ii  afio                      2.5-3          archive file manipulation program
ii  binutils                  2.15-6         The GNU assembler, linker and bina
ii  buffer                    1.19-7         Buffering/reblocking program for t
ii  cdrecord                  4:2.01+01a01-2 command line CD writing tool
ii  dosfstools                2.11-2         Utilities to create and check MS-D
ii  gawk                      1:3.1.4-2      GNU awk, a pattern scanning and pr
ii  libc6                     2.3.2.ds1-22   GNU C Library: Shared libraries an
ii  libnewt0.51               0.51.6-20      Not Erik's Windowing Toolkit - tex
ii  lzop                      1.01-3         fast compression program
ii  mindi                     1.04-4         creates boot/root disks based on y

Versions of packages mindi depends on:
ii  bzip2                     1.0.2-7        high-quality block-sorting file co
ii  file                      4.12-1         Determines file type using "magic"
ii  gawk                      1:3.1.4-2      GNU awk, a pattern scanning and pr
ii  mindi-busybox             1.00-4         Collection of shell utilities in a
ii  mindi-kernel              2.4.27-2       failsafe Linux kernel for Mindi/Mo
ii  mindi-partimagehack       0.6.2-4        disk partition imaging utility for
ii  mkisofs                   4:2.01+01a01-2 Creates ISO-9660 CD-ROM filesystem
ii  ms-sys                    1.1.3-1        Write a Microsoft compatible boot 
ii  nano                      1.2.4-5        free Pico clone with some new feat
ii  parted                    1.6.21-1       The GNU Parted disk partition resi
ii  syslinux                  2.11-0.1       Bootloader for Linux/i386 using MS

-- no debconf information
diff -ruN mondo-2.04-old/mondo/common/libmondo-mountlist.c mondo-2.04/mondo/common/libmondo-mountlist.c
--- mondo-2.04-old/mondo/common/libmondo-mountlist.c	2004-10-08 22:31:34.000000000 +0200
+++ mondo-2.04/mondo/common/libmondo-mountlist.c	2005-08-31 03:39:42.000000000 +0200
@@ -841,7 +841,8 @@
     {
       
       strcpy (drive, mountlist->el[lino].device);
-      if (!strncmp (drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB)))
+      if ( !strncmp (drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB)) ||
+	   strstr (drive, "/dev/mapper") )
 	{
 	  sprintf (tmp,
 		   "Not putting %s in list of drives: it's a virtual drive",
diff -ruN mondo-2.04-old/mondo/mondorestore/mondo-prep.c mondo-2.04/mondo/mondorestore/mondo-prep.c
--- mondo-2.04-old/mondo/mondorestore/mondo-prep.c	2004-10-08 22:31:34.000000000 +0200
+++ mondo-2.04/mondo/mondorestore/mondo-prep.c	2005-08-31 03:40:35.000000000 +0200
@@ -785,17 +785,14 @@
 		log_to_screen(tmp);
 
 // Shouldn't be necessary.
-		log_to_screen("Stopping %s", device);
-		stop_raid_device(device);
 		system("sync"); sleep(1);
 		if (g_fprep) { fprintf(g_fprep, "%s\n", program); }
 
 		log_msg(1, "Making %s", device);
-		sprintf(program, "mkraid --really-force %s", device);
+		sprintf(program, "mdrun");
 		res = run_program_and_log_output(program, 1);
 		log_msg(1, "%s returned %d", program, res);
 		system("sync"); sleep(3);
-		start_raid_device(device);
 		if (g_fprep) { fprintf(g_fprep, "%s\n", program); }
 		system("sync"); sleep(2);
 		
@@ -852,8 +849,98 @@
 }
 
 
+int create_all_raid_devices(struct raidlist_itself *raidlist)
+{
+  int i,j;
+  int res;
+
+  /** buffers ***********************************************************/
+  char *program;
+  char *devices;
+  char *all_devices;
+
+  /** end ****************************************************************/
+
+  malloc_string(program);
+  malloc_string(devices);
+  malloc_string(all_devices);
+
+  if (!raidlist || raidlist->entries == 0) {
+      log_msg(1, "No RAID disk found");
+      return 0;
+  }
+
+  all_devices[0] = '\0';
+
+  for (i=0; i<raidlist->entries; i++) 
+    {
+      devices[0] = '\0';
+      log_msg(1, "adding : %s", raidlist->el[i].raid_device );
+      log_msg(1, "         raid level %d", raidlist->el[i].raid_level );
+      log_msg(1, "         chunk size %d", raidlist->el[i].chunk_size );
+      log_msg(1, "         devices %d", raidlist->el[i].data_disks.entries );
+      log_msg(1, "         spare %d", raidlist->el[i].spare_disks.entries );
+
+      /* build device list */
+      for (j=0; j < raidlist->el[i].data_disks.entries; j++)
+	{
+	  log_msg(1, "         device %s", raidlist->el[i].data_disks.el[j].device );
+	  strcat(devices, raidlist->el[i].data_disks.el[j].device);
+	  strcat(devices, " ");
+	}
+
+      for (j=0; j < raidlist->el[i].spare_disks.entries; j++)
+	{
+	  log_msg(1, "         spare %s", raidlist->el[i].spare_disks.el[j].device );
+	  strcat(devices, raidlist->el[i].spare_disks.el[j].device);
+	  strcat(devices, " ");	  
+	}
+
+      log_msg(1, "raid devices : %s", devices);
+
+      strcat(all_devices, devices);
+
+      /* clean superblocks*/
+      for (j=0; j < raidlist->el[i].data_disks.entries; j++)
+	{
+	  sprintf(program, "mdadm --zero-superblock --force %s",
+		  raidlist->el[i].data_disks.el[j].device);
+	  res = run_program_and_log_output(program, 1);
+	}
 
+      for (j=0; j < raidlist->el[i].spare_disks.entries; j++)
+	{
+	  sprintf(program, "mdadm --zero-superblock --force %s",
+		  raidlist->el[i].spare_disks.el[j].device);
+	  res = run_program_and_log_output(program, 1);
+	}
+
+      /* create raid array*/
+      sprintf(program, "mdadm --create --force --run %s --level %d --raid-devices=%d --spare-devices=%d %s",
+	      raidlist->el[i].raid_device,
+	      raidlist->el[i].raid_level,
+	      raidlist->el[i].data_disks.entries,
+	      raidlist->el[i].spare_disks.entries,
+	      devices);
+      log_msg(1, "Trying : %s", program);
+      res = run_program_and_log_output(program, 1);
+      log_msg(1, "%s returned %d", program, res);
+      
+    }
+	
+  /* create new /etc/mdadm/mdadm.conf */
+  sprintf(program, "echo DEVICE %s >/tmp/mdadm.conf", all_devices);
+  res = system( program );
+
+  sprintf(program, "mdadm --detail --scan >>/tmp/mdadm.conf");
+  res = system( program );
+     
+  paranoid_free(all_devices);
+  paranoid_free(devices);
+  paranoid_free(program);
 
+  return 0;
+}
 
 /**
  * Format all drives (except those excluded by format_device()) in @p mountlist.
@@ -894,9 +981,9 @@
 	progress_step = (mountlist->entries > 0) ? g_maximum_progress / mountlist->entries : 1;
 // start soft-raids now (because LVM might depend on them)
 // ...and for simplicity's sake, let's format them at the same time :)
-	log_msg(1, "Stopping all RAID devices");
-	stop_all_raid_devices(mountlist);
-	system("sync"); system("sync"); system("sync"); 
+	log_msg(1, "Starting all RAID devices");
+	start_all_raid_devices(mountlist);
+	system("sync"); system("sync"); system("sync");
 	sleep(2);
 	log_msg(1, "Prepare soft-RAIDs"); // prep and format too
 	for (lino = 0; lino < mountlist->entries; lino++) {
@@ -911,7 +998,7 @@
 				do_it = TRUE;
 			}
 			if (do_it) {
-			// NB: format_device() also stops/starts RAID device if necessary
+			// NB: format_device() also stops/starts RAID device if necessary			  
 				retval += format_device(me->device, me->format);
 			}
 			g_current_progress += progress_step;
@@ -1629,7 +1716,8 @@
 
 	log_it("partition_device('%s', %d, %d, '%s', %lld) --- starting", drive, partno, prev_partno, format, partsize);
 
-	if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) {
+	if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB)) ||
+	    strstr(drive, "/dev/mapper")) {
 		sprintf(tmp, "Not partitioning %s - it is a virtual drive", drive);
 		log_it(tmp);
 		paranoid_free(program);
@@ -1806,7 +1894,7 @@
  * @note This sets the partition types but doesn't actually do the formatting.
  * Use format_everything() for that.
  */
-int partition_everything(struct mountlist_itself *mountlist)
+int partition_everything(struct mountlist_itself *mountlist, struct raidlist_itself *raidlist)
 {
 	/** int ************************************************************/
 	int lino;
@@ -1842,7 +1930,7 @@
 	log_msg(0, "Stopping all software RAID devices, just in case");
 	stop_all_raid_devices(mountlist);
 	log_msg(0, "Done.");
-	
+
 /*	
 	if (does_file_exist("/tmp/i-want-my-lvm"))
 	  {
@@ -1868,6 +1956,10 @@
 		mvaddstr_and_log_it(g_currentY++, 74, "Done.");
 		paranoid_system("rm -f /tmp/fdisk*.log 2> /dev/null");
 	}
+
+	log_msg(1, "Creating RAID devices");
+	create_all_raid_devices(raidlist);
+
 	newtSuspend();
 	system("clear");
 	newtResume();
@@ -2042,9 +2134,8 @@
 	}
 	sprintf(program, "vinum start -f %s", raid_device);
 #else
-	sprintf(program, "raidstart %s", raid_device);
-//      sprintf (program, "raidstart " RAID_DEVICE_STUB "*");
-#endif
+	sprintf(program, "mdrun %s", raid_device);
+#endif // __FreeBSD__
 	log_msg(1, "program = %s", program);
 	res = run_program_and_log_output(program, 1);
 	if (g_fprep) { fprintf(g_fprep, "%s\n", program); }
@@ -2082,9 +2173,8 @@
 	}
 	sprintf(program, "vinum stop -f %s", raid_device);
 #else
-	sprintf(program, "raidstop %s", raid_device);
-//      sprintf (program, "raidstop " RAID_DEVICE_STUB "*");
-#endif
+	sprintf(program, "mdadm -S %s", raid_device);
+#endif // __FreeBSD__
 	log_msg(1, "program = %s", program);
 	res = run_program_and_log_output(program, 1);
 	if (g_fprep) { fprintf(g_fprep, "%s\n", program); }
diff -ruN mondo-2.04-old/mondo/mondorestore/mondo-restore.c mondo-2.04/mondo/mondorestore/mondo-restore.c
--- mondo-2.04-old/mondo/mondorestore/mondo-restore.c	2004-10-03 13:55:33.000000000 +0200
+++ mondo-2.04/mondo/mondorestore/mondo-restore.c	2005-08-30 14:23:01.000000000 +0200
@@ -420,7 +420,7 @@
 extern int g_partition_table_locked_up;
 extern int g_noof_rows;
 
-extern int partition_everything(struct mountlist_itself *mountlist);
+extern int partition_everything(struct mountlist_itself *mountlist, struct raidlist_itself *);
 
 
 /**
@@ -842,7 +842,7 @@
 		{
 		  twenty_seconds_til_yikes();
 		  g_fprep = fopen("/tmp/prep.sh", "w");
-		  ptn_errs = partition_everything( mountlist );
+		  ptn_errs = partition_everything( mountlist, raidlist );
 		  if (ptn_errs)
 		    {
 		      log_to_screen("Warning. Errors occurred during disk partitioning.");
@@ -1171,7 +1171,7 @@
 	      }
 	  else
 	      {
-		  res = partition_everything( mountlist );
+		  res = partition_everything( mountlist, raidlist );
 		  if (res)
 		    {
 		      log_to_screen("Warning. Errors occurred during partitioning.");
@@ -3476,7 +3476,7 @@
           load_raidtab_into_raidlist( raidlist, RAIDTAB_FNAME );
           strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
 	  load_mountlist( mountlist, g_mountlist_fname );
-          res = partition_everything(mountlist);
+          res = partition_everything(mountlist, raidlist);
           finish(res);
         }
 
diff -ruN mondo-2.04-old/mondo/mondorestore/mondoprep.h mondo-2.04/mondo/mondorestore/mondoprep.h
--- mondo-2.04-old/mondo/mondorestore/mondoprep.h	2004-07-23 21:42:11.000000000 +0200
+++ mondo-2.04/mondo/mondorestore/mondoprep.h	2005-08-30 14:23:01.000000000 +0200
@@ -64,7 +64,7 @@
 int partition_device_with_fdisk (FILE*,const char *, int, int, const char *, long long);
 int format_device (char *, char *);
 int partition_drive (struct mountlist_itself *, char *);
-int partition_everything (struct mountlist_itself *);
+int partition_everything (struct mountlist_itself *, struct raidlist_itself *);
 int do_my_funky_lvm_stuff (bool, bool);
 int which_format_command_do_i_need (char *, char *);
 int make_dummy_partitions (FILE*, char *, int);
diff -ruN mondo-2.04-old/mondo/mondorestore/mr-externs.h mondo-2.04/mondo/mondorestore/mr-externs.h
--- mondo-2.04-old/mondo/mondorestore/mr-externs.h	2004-07-23 21:42:11.000000000 +0200
+++ mondo-2.04/mondo/mondorestore/mr-externs.h	2005-08-30 14:23:01.000000000 +0200
@@ -54,7 +54,7 @@
 extern int partition_device_with_fdisk(char*,int,int,char*,long);
 extern int partition_device_with_parted(char*,int,int,char*,long);
 extern int partition_drive(struct mountlist_itself*, char*);
-extern int partition_everything(struct mountlist_itself*);
+extern int partition_everything(struct mountlist_itself*, struct raidlist_itself*);
 extern void popup_and_OK(char*);
 extern bool popup_and_get_string(char*,char*,char*, int);
 extern void setup_newt_stuff(void);

Reply via email to