[Patch] mdmfs currently broken

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Thu, 4 Sep 2003 20:28:56 +0200
Seems that mdmfs stopped working recently (probably because
of GEOM related changes). One possible fix is to label the
md and newfs the thusly created c partition.

This requires running /sbin/disklabel, which didn't have an
entry in paths.h.

Any objections against me committing the follwoing fixes to
-current ?

Should md0c be used as a parameter to mdmfs instead of md0
(and should it be printed in df and mount output) ???

Regards, STefan



Index: include/paths.h
===================================================================
RCS file: /usr/cvs/src/include/paths.h,v
retrieving revision 1.24
diff -u -3 -r1.24 paths.h
--- include/paths.h	29 Jun 2003 18:35:36 -0000	1.24
+++ include/paths.h	4 Sep 2003 18:12:27 -0000
_at__at_ -58,6 +58,7 _at__at_
 #define	_PATH_DEFTAPE	"/dev/sa0"
 #define	_PATH_DEVNULL	"/dev/null"
 #define	_PATH_DEVZERO	"/dev/zero"
+#define	_PATH_DISKLABEL	"/sbin/disklabel"
 #define	_PATH_DRUM	"/dev/drum"
 #define	_PATH_ETC	"/etc"
 #define	_PATH_FTPUSERS	"/etc/ftpusers"
_at__at_ -113,6 +114,8 _at__at_
 #define	_PATH_CP	"/rescue/cp"
 #undef	_PATH_CSHELL
 #define	_PATH_CSHELL	"/rescue/csh"
+#undef	_PATH_DISKLABEL
+#define	_PATH_DISKLABEL	"/rescue/disklabel"
 #undef	_PATH_HALT
 #define	_PATH_HALT	"/rescue/halt"
 #undef	_PATH_IFCONFIG
Index: sbin/mdmfs/mdmfs.c
===================================================================
RCS file: /usr/cvs/src/sbin/mdmfs/mdmfs.c,v
retrieving revision 1.17
diff -u -3 -r1.17 mdmfs.c
--- sbin/mdmfs/mdmfs.c	5 Aug 2003 15:04:39 -0000	1.17
+++ sbin/mdmfs/mdmfs.c	4 Sep 2003 18:09:02 -0000
_at__at_ -77,6 +77,7 _at__at_
 static void	 do_mount(const char *, const char *);
 static void	 do_mtptsetup(const char *, struct mtpt_info *);
 static void	 do_newfs(const char *);
+static void	 do_disklabel(void);
 static void	 extract_ugid(const char *, struct mtpt_info *);
 static int	 run(int *, const char *, ...) __printflike(2, 3);
 static void	 usage(void);
_at__at_ -264,6 +265,7 _at__at_
 		do_mdconfig_attach_au(mdconfig_arg, mdtype);
 	else
 		do_mdconfig_attach(mdconfig_arg, mdtype);
+	do_disklabel();
 	do_newfs(newfs_arg);
 	do_mount(mount_arg, mtpoint);
 	do_mtptsetup(mtpoint, &mi);
_at__at_ -467,6 +469,19 _at__at_
 }
 
 /*
+ * Write simple disklabel
+ */
+static void
+do_disklabel(void)
+{
+	int rv;
+
+	rv = run(NULL, "%s -w /dev/%s%d auto", _PATH_DISKLABEL, mdname, unit);
+	if (rv)
+		errx(1, "disklabel exited with error code %d", rv);
+}
+
+/*
  * Put a file system on the memory disk.
  */
 static void
_at__at_ -474,7 +489,7 _at__at_
 {
 	int rv;
 
-	rv = run(NULL, "%s%s /dev/%s%d", _PATH_NEWFS, args, mdname, unit);
+	rv = run(NULL, "%s%s /dev/%s%dc", _PATH_NEWFS, args, mdname, unit);
 	if (rv)
 		errx(1, "newfs exited with error code %d", rv);
 }
Received on Thu Sep 04 2003 - 09:29:01 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:21 UTC