Bug 51897

Summary: Add example for disklable for md devices
Product: Documentation Reporter: Kevin Oberman <oberman>
Component: Books & ArticlesAssignee: Marc Fonvieille <blackend>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Kevin Oberman 2003-05-06 23:20:10 UTC
I would like to request an small addition to the man page for
mdconfig. It has no examples of labeling a memory disk. There was such
an example in the old vnconfig man page. This might replace the existing
example for creating an md device with /tmp/boot.flp as backing.

Fix: 

Add the following:

     To create a disk named /dev/md0 with somebackingfile as backing and
     label it with ffs partitions:

           mdconfig -a -t vnode -f somebackingfile -u 0
           disklabel -r -w md0 auto
           disklabel -e md0
How-To-Repeat: 	N/A
Comment 1 simon 2003-05-07 01:03:59 UTC
Hello

A patch could be as below.

Note I have changed the proposed commands a bit since to match new usage
of disklabel and to init the backing file.

I just add it as a different example since it IMO serves a different
purpose than the example with backing of /tmp/boot.flp.

Btw. note my posting to freebsd-current about disklabel coredumping if
anyones decides to try this.

%%%
Index: mdconfig.8
===================================================================
RCS file: /home/ncvs/src/sbin/mdconfig/mdconfig.8,v
retrieving revision 1.19
diff -u -d -r1.19 mdconfig.8
--- mdconfig.8	27 Apr 2003 01:46:56 -0000	1.19
+++ mdconfig.8	6 May 2003 23:54:40 -0000
@@ -164,6 +164,18 @@
 mount /dev/md10 /tmp
 chmod 1777 /tmp
 .Ed
+.Pp
+To create a 10MB memory disk named
+.Pa /dev/md0
+with the file
+.Pa somebackingfile
+as backing and label it with normal partitions:
+.Bd -literal -offset indent
+dd if=/dev/zero of=somebackingfile bs=1k count=10k
+mdconfig -a -t vnode -f somebackingfile -u 0
+disklabel -w md0
+disklabel -e md0
+.Ed
 .Sh SEE ALSO
 .Xr md 4 ,
 .Xr disklabel 8 ,
%%%

-- 
Simon L. Nielsen
Comment 2 simon 2003-05-19 01:17:23 UTC
Adding relevant part of notes by blackend@ and myself regarding this PR
to the audit-trail.

----- Forwarded message from Marc Fonvieille <blackend@FreeBSD.org> -----

From: Marc Fonvieille <blackend@FreeBSD.org>
Date: Wed, 7 May 2003 20:36:49 +0200
To: "Simon L. Nielsen" <simon@nitro.dk>
Cc: freebsd-doc@FreeBSD.org
User-Agent: Mutt/1.4i
Subject: Re: docs/51897: Add example for disklable for md devices

On Wed, May 07, 2003 at 10:58:48AM +0200, Simon L. Nielsen wrote:
> > We shoould be consistent with other docs (Handbook etc..) i.e.
> > disklabel -r -w md0 auto
> 
> Actually it was on purpose that I changed that.  As I understand it '-r'
> and 'auto' are not needed anymore post GEOM.  The examples in
> bsdlabel(8) does not use auto and this is the code handling '-r' :
>


Well I did not think about the brand new disklabel :(

> 	case 'r':
> 		/*
> 		 * We accept and ignode -r for compatibility with
> 		 * historically disklabel usage.
> 		 */
> 		break;
> 
> I would rather say that the rest of the docs should be change not to use
> '-r' and 'auto' and perhaps add a compatibility note for FreeBSD < 5.0.
> 


You meant 5.1 I think.
In the Handbook I would write that -r and auto options can be safely
omitted on FreeBSD 5.1 and later.

Marc

----- End forwarded message -----

-- 
Simon L. Nielsen
Comment 3 Marc Fonvieille freebsd_committer freebsd_triage 2003-05-19 10:05:37 UTC
Responsible Changed
From-To: freebsd-doc->blackend

I will take it since I'm in the audit-trail.
Comment 4 Marc Fonvieille freebsd_committer freebsd_triage 2003-10-11 10:59:41 UTC
State Changed
From-To: open->closed

I added the Handbook's example.  Thanks.