xref: /freebsd/sbin/newfs/newfs.c (revision e627b39baccd1ec9129690167cf5e6d860509655)
1 /*
2  * Copyright (c) 1983, 1989, 1993, 1994
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *	This product includes software developed by the University of
16  *	California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33 
34 #ifndef lint
35 static char sccsid[] = "@(#)newfs.c	8.8 (Berkeley) 4/18/94";
36 #endif /* not lint */
37 
38 #ifndef lint
39 static char copyright[] =
40 "@(#) Copyright (c) 1983, 1989, 1993, 1994\n\
41 	The Regents of the University of California.  All rights reserved.\n";
42 #endif /* not lint */
43 
44 /*
45  * newfs: friendly front end to mkfs
46  */
47 #include <sys/param.h>
48 #include <sys/stat.h>
49 #include <sys/ioctl.h>
50 #include <sys/disklabel.h>
51 #include <sys/file.h>
52 #include <sys/mount.h>
53 
54 #include <ufs/ufs/dir.h>
55 #include <ufs/ffs/fs.h>
56 
57 #include <ctype.h>
58 #include <errno.h>
59 #include <paths.h>
60 #include <stdio.h>
61 #include <stdlib.h>
62 #include <string.h>
63 #include <syslog.h>
64 #include <unistd.h>
65 
66 #if __STDC__
67 #include <stdarg.h>
68 #else
69 #include <varargs.h>
70 #endif
71 
72 #include "mntopts.h"
73 
74 struct mntopt mopts[] = {
75 	MOPT_STDOPTS,
76 	MOPT_ASYNC,
77 	{ NULL },
78 };
79 
80 #if __STDC__
81 void	fatal(const char *fmt, ...);
82 #else
83 void	fatal();
84 #endif
85 
86 #define	COMPAT			/* allow non-labeled disks */
87 
88 /*
89  * The following two constants set the default block and fragment sizes.
90  * Both constants must be a power of 2 and meet the following constraints:
91  *	MINBSIZE <= DESBLKSIZE <= MAXBSIZE
92  *	sectorsize <= DESFRAGSIZE <= DESBLKSIZE
93  *	DESBLKSIZE / DESFRAGSIZE <= 8
94  */
95 #define	DFL_FRAGSIZE	1024
96 #define	DFL_BLKSIZE	8192
97 
98 /*
99  * Cylinder groups may have up to many cylinders. The actual
100  * number used depends upon how much information can be stored
101  * on a single cylinder. The default is to use 16 cylinders
102  * per group.
103  */
104 #define	DESCPG		16	/* desired fs_cpg */
105 
106 /*
107  * Once upon a time...
108  *    ROTDELAY gives the minimum number of milliseconds to initiate
109  *    another disk transfer on the same cylinder. It is used in
110  *    determining the rotationally optimal layout for disk blocks
111  *    within a file; the default of fs_rotdelay is 4ms.
112  *
113  * ...but now we make this 0 to disable the rotdelay delay because
114  * modern drives with read/write-behind achieve higher performance
115  * without the delay.
116  */
117 #define ROTDELAY	0
118 
119 /*
120  * MAXBLKPG determines the maximum number of data blocks which are
121  * placed in a single cylinder group. The default is one indirect
122  * block worth of data blocks.
123  */
124 #define MAXBLKPG(bsize)	((bsize) / sizeof(daddr_t))
125 
126 /*
127  * Each file system has a number of inodes statically allocated.
128  * We allocate one inode slot per NFPI fragments, expecting this
129  * to be far more than we will ever need.
130  */
131 #define	NFPI		4
132 
133 /*
134  * Once upon a time...
135  *    For each cylinder we keep track of the availability of blocks at different
136  *    rotational positions, so that we can lay out the data to be picked
137  *    up with minimum rotational latency.  NRPOS is the default number of
138  *    rotational positions that we distinguish.  With NRPOS of 8 the resolution
139  *    of our summary information is 2ms for a typical 3600 rpm drive.
140  *
141  * ...but now we make this 1 (which escentially disables the rotational
142  * position table because modern drives with read-ahead and write-behind do
143  * better without the rotational position table.
144  */
145 #define	NRPOS		1	/* number distinct rotational positions */
146 
147 /*
148  * About the same time as the above, we knew what went where on the disks.
149  * no longer so, so kill the code which finds the different platters too...
150  * We do this by saying one head, with a lot of sectors on it.
151  * The number of sectors are used to determine the size of a cyl-group.
152  * Kirk suggested one or two meg per "cylinder" so we say two.
153  */
154 
155 #define NTRACKS		1	/* number of heads */
156 
157 #define NSECTORS	4096	/* number of sectors */
158 
159 int	mfs;			/* run as the memory based filesystem */
160 int	Nflag;			/* run without writing file system */
161 int	Oflag;			/* format as an 4.3BSD file system */
162 int	fssize;			/* file system size */
163 int	ntracks = NTRACKS;	/* # tracks/cylinder */
164 int	nsectors = NSECTORS;	/* # sectors/track */
165 int	nphyssectors;		/* # sectors/track including spares */
166 int	secpercyl;		/* sectors per cylinder */
167 int	trackspares = -1;	/* spare sectors per track */
168 int	cylspares = -1;		/* spare sectors per cylinder */
169 int	sectorsize;		/* bytes/sector */
170 #ifdef tahoe
171 int	realsectorsize;		/* bytes/sector in hardware */
172 #endif
173 int	rpm;			/* revolutions/minute of drive */
174 int	interleave;		/* hardware sector interleave */
175 int	trackskew = -1;		/* sector 0 skew, per track */
176 int	headswitch;		/* head switch time, usec */
177 int	trackseek;		/* track-to-track seek, usec */
178 int	fsize = 0;		/* fragment size */
179 int	bsize = 0;		/* block size */
180 int	cpg = DESCPG;		/* cylinders/cylinder group */
181 int	cpgflg;			/* cylinders/cylinder group flag was given */
182 int	minfree = MINFREE;	/* free space threshold */
183 int	opt = DEFAULTOPT;	/* optimization preference (space or time) */
184 int	density;		/* number of bytes per inode */
185 int	maxcontig = 0;		/* max contiguous blocks to allocate */
186 int	rotdelay = ROTDELAY;	/* rotational delay between blocks */
187 int	maxbpg;			/* maximum blocks per file in a cyl group */
188 int	nrpos = NRPOS;		/* # of distinguished rotational positions */
189 int	bbsize = BBSIZE;	/* boot block size */
190 int	sbsize = SBSIZE;	/* superblock size */
191 int	mntflags = MNT_ASYNC;	/* flags to be passed to mount */
192 int	t_or_u_flag = 0;	/* user has specified -t or -u */
193 u_long	memleft;		/* virtual memory available */
194 caddr_t	membase;		/* start address of memory based filesystem */
195 char	*filename;
196 #ifdef COMPAT
197 char	*disktype;
198 int	unlabeled;
199 #endif
200 
201 char	device[MAXPATHLEN];
202 char	*progname;
203 
204 int
205 main(argc, argv)
206 	int argc;
207 	char *argv[];
208 {
209 	extern char *optarg;
210 	extern int optind;
211 	register int ch;
212 	register struct partition *pp;
213 	register struct disklabel *lp;
214 	struct disklabel *getdisklabel();
215 	struct partition oldpartition;
216 	struct stat st;
217 	struct statfs *mp;
218 	int fsi, fso, len, n;
219 	char *cp, *s1, *s2, *special, *opstring, buf[BUFSIZ];
220 #ifdef MFS
221 	struct vfsconf *vfc;
222 #endif
223 
224 	if (progname = rindex(*argv, '/'))
225 		++progname;
226 	else
227 		progname = *argv;
228 
229 	if (strstr(progname, "mfs")) {
230 		mfs = 1;
231 		Nflag++;
232 	}
233 
234 	opstring = mfs ?
235 	    "NF:T:a:b:c:d:e:f:i:m:o:s:" :
236 	    "NOS:T:a:b:c:d:e:f:i:k:l:m:n:o:p:r:s:t:u:x:";
237 	while ((ch = getopt(argc, argv, opstring)) != EOF)
238 		switch (ch) {
239 		case 'N':
240 			Nflag = 1;
241 			break;
242 		case 'O':
243 			Oflag = 1;
244 			break;
245 		case 'S':
246 			if ((sectorsize = atoi(optarg)) <= 0)
247 				fatal("%s: bad sector size", optarg);
248 			break;
249 #ifdef COMPAT
250 		case 'T':
251 			disktype = optarg;
252 			break;
253 #endif
254 		case 'F':
255 			filename = optarg;
256 			break;
257 		case 'a':
258 			if ((maxcontig = atoi(optarg)) <= 0)
259 				fatal("%s: bad maximum contiguous blocks\n",
260 				    optarg);
261 			break;
262 		case 'b':
263 			if ((bsize = atoi(optarg)) < MINBSIZE)
264 				fatal("%s: bad block size", optarg);
265 			break;
266 		case 'c':
267 			if ((cpg = atoi(optarg)) <= 0)
268 				fatal("%s: bad cylinders/group", optarg);
269 			cpgflg++;
270 			break;
271 		case 'd':
272 			if ((rotdelay = atoi(optarg)) < 0)
273 				fatal("%s: bad rotational delay\n", optarg);
274 			break;
275 		case 'e':
276 			if ((maxbpg = atoi(optarg)) <= 0)
277 		fatal("%s: bad blocks per file in a cylinder group\n",
278 				    optarg);
279 			break;
280 		case 'f':
281 			if ((fsize = atoi(optarg)) <= 0)
282 				fatal("%s: bad fragment size", optarg);
283 			break;
284 		case 'i':
285 			if ((density = atoi(optarg)) <= 0)
286 				fatal("%s: bad bytes per inode\n", optarg);
287 			break;
288 		case 'k':
289 			if ((trackskew = atoi(optarg)) < 0)
290 				fatal("%s: bad track skew", optarg);
291 			break;
292 		case 'l':
293 			if ((interleave = atoi(optarg)) <= 0)
294 				fatal("%s: bad interleave", optarg);
295 			break;
296 		case 'm':
297 			if ((minfree = atoi(optarg)) < 0 || minfree > 99)
298 				fatal("%s: bad free space %%\n", optarg);
299 			break;
300 		case 'n':
301 			if ((nrpos = atoi(optarg)) < 0)
302 				fatal("%s: bad rotational layout count\n",
303 				    optarg);
304 			if (nrpos == 0)
305 				nrpos = 1;
306 			break;
307 		case 'o':
308 			if (mfs)
309 				getmntopts(optarg, mopts, &mntflags, 0);
310 			else {
311 				if (strcmp(optarg, "space") == 0)
312 					opt = FS_OPTSPACE;
313 				else if (strcmp(optarg, "time") == 0)
314 					opt = FS_OPTTIME;
315 				else
316 	fatal("%s: unknown optimization preference: use `space' or `time'.");
317 			}
318 			break;
319 		case 'p':
320 			if ((trackspares = atoi(optarg)) < 0)
321 				fatal("%s: bad spare sectors per track",
322 				    optarg);
323 			break;
324 		case 'r':
325 			if ((rpm = atoi(optarg)) <= 0)
326 				fatal("%s: bad revolutions/minute\n", optarg);
327 			break;
328 		case 's':
329 			if ((fssize = atoi(optarg)) <= 0)
330 				fatal("%s: bad file system size", optarg);
331 			break;
332 		case 't':
333 			t_or_u_flag++;
334 			if ((ntracks = atoi(optarg)) < 0)
335 				fatal("%s: bad total tracks", optarg);
336 			break;
337 		case 'u':
338 			t_or_u_flag++;
339 			if ((nsectors = atoi(optarg)) < 0)
340 				fatal("%s: bad sectors/track", optarg);
341 			break;
342 		case 'x':
343 			if ((cylspares = atoi(optarg)) < 0)
344 				fatal("%s: bad spare sectors per cylinder",
345 				    optarg);
346 			break;
347 		case '?':
348 		default:
349 			usage();
350 		}
351 	argc -= optind;
352 	argv += optind;
353 
354 	if (argc != 2 && (mfs || argc != 1))
355 		usage();
356 
357 	special = argv[0];
358 	cp = rindex(special, '/');
359 	if (cp == 0) {
360 		/*
361 		 * No path prefix; try /dev/r%s then /dev/%s.
362 		 */
363 		(void)sprintf(device, "%sr%s", _PATH_DEV, special);
364 		if (stat(device, &st) == -1)
365 			(void)sprintf(device, "%s%s", _PATH_DEV, special);
366 		special = device;
367 	}
368 	if (Nflag) {
369 		fso = -1;
370 	} else {
371 		fso = open(special, O_WRONLY);
372 		if (fso < 0)
373 			fatal("%s: %s", special, strerror(errno));
374 
375 		/* Bail if target special is mounted */
376 		n = getmntinfo(&mp, MNT_NOWAIT);
377 		if (n == 0)
378 			fatal("%s: getmntinfo: %s", special, strerror(errno));
379 
380 		len = sizeof(_PATH_DEV) - 1;
381 		s1 = special;
382 		if (strncmp(_PATH_DEV, s1, len) == 0)
383 			s1 += len;
384 
385 		while (--n >= 0) {
386 			s2 = mp->f_mntfromname;
387 			if (strncmp(_PATH_DEV, s2, len) == 0) {
388 				s2 += len - 1;
389 				*s2 = 'r';
390 			}
391 			if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0)
392 				fatal("%s is mounted on %s",
393 				    special, mp->f_mntonname);
394 			++mp;
395 		}
396 	}
397 	if (mfs && disktype != NULL) {
398 		lp = (struct disklabel *)getdiskbyname(disktype);
399 		if (lp == NULL)
400 			fatal("%s: unknown disk type", disktype);
401 		pp = &lp->d_partitions[1];
402 	} else {
403 		fsi = open(special, O_RDONLY);
404 		if (fsi < 0)
405 			fatal("%s: %s", special, strerror(errno));
406 		if (fstat(fsi, &st) < 0)
407 			fatal("%s: %s", special, strerror(errno));
408 		if ((st.st_mode & S_IFMT) != S_IFCHR && !mfs)
409 			printf("%s: %s: not a character-special device\n",
410 			    progname, special);
411 		cp = index(argv[0], '\0') - 1;
412 		if (cp == 0 || (*cp < 'a' || *cp > 'h') && !isdigit(*cp))
413 			fatal("%s: can't figure out file system partition",
414 			    argv[0]);
415 #ifdef COMPAT
416 		if (!mfs && disktype == NULL)
417 			disktype = argv[1];
418 #endif
419 		lp = getdisklabel(special, fsi);
420 		if (isdigit(*cp))
421 			pp = &lp->d_partitions[0];
422 		else
423 			pp = &lp->d_partitions[*cp - 'a'];
424 		if (pp->p_size == 0)
425 			fatal("%s: `%c' partition is unavailable",
426 			    argv[0], *cp);
427 		if (pp->p_fstype == FS_BOOT)
428 			fatal("%s: `%c' partition overlaps boot program",
429 			      argv[0], *cp);
430 	}
431 	if (fssize == 0)
432 		fssize = pp->p_size;
433 	if (fssize > pp->p_size && !mfs)
434 	       fatal("%s: maximum file system size on the `%c' partition is %d",
435 			argv[0], *cp, pp->p_size);
436 	if (rpm == 0) {
437 		rpm = lp->d_rpm;
438 		if (rpm <= 0)
439 			rpm = 3600;
440 	}
441 	if (ntracks == 0) {
442 		ntracks = lp->d_ntracks;
443 		if (ntracks <= 0)
444 			fatal("%s: no default #tracks", argv[0]);
445 	}
446 	if (nsectors == 0) {
447 		nsectors = lp->d_nsectors;
448 		if (nsectors <= 0)
449 			fatal("%s: no default #sectors/track", argv[0]);
450 	}
451 	if (sectorsize == 0) {
452 		sectorsize = lp->d_secsize;
453 		if (sectorsize <= 0)
454 			fatal("%s: no default sector size", argv[0]);
455 	}
456 	if (trackskew == -1) {
457 		trackskew = lp->d_trackskew;
458 		if (trackskew < 0)
459 			trackskew = 0;
460 	}
461 	if (interleave == 0) {
462 		interleave = lp->d_interleave;
463 		if (interleave <= 0)
464 			interleave = 1;
465 	}
466 	if (fsize == 0) {
467 		fsize = pp->p_fsize;
468 		if (fsize <= 0)
469 			fsize = MAX(DFL_FRAGSIZE, lp->d_secsize);
470 	}
471 	if (bsize == 0) {
472 		bsize = pp->p_frag * pp->p_fsize;
473 		if (bsize <= 0)
474 			bsize = MIN(DFL_BLKSIZE, 8 * fsize);
475 	}
476 	/*
477 	 * Maxcontig sets the default for the maximum number of blocks
478 	 * that may be allocated sequentially. With filesystem clustering
479 	 * it is possible to allocate contiguous blocks up to the maximum
480 	 * transfer size permitted by the controller or buffering.
481 	 */
482 	if (maxcontig == 0)
483 		maxcontig = MAX(1, MAXPHYS / bsize - 1);
484 	if (density == 0)
485 		density = NFPI * fsize;
486 	if (minfree < MINFREE && opt != FS_OPTSPACE) {
487 		fprintf(stderr, "Warning: changing optimization to space ");
488 		fprintf(stderr, "because minfree is less than %d%%\n", MINFREE);
489 		opt = FS_OPTSPACE;
490 	}
491 	if (trackspares == -1) {
492 		trackspares = lp->d_sparespertrack;
493 		if (trackspares < 0)
494 			trackspares = 0;
495 	}
496 	nphyssectors = nsectors + trackspares;
497 	if (cylspares == -1) {
498 		cylspares = lp->d_sparespercyl;
499 		if (cylspares < 0)
500 			cylspares = 0;
501 	}
502 	secpercyl = nsectors * ntracks - cylspares;
503 	/*
504 	 * Only complain if -t or -u have been specified; the default
505 	 * case (4096 sectors per cylinder) is intented to disagree
506 	 * with the disklabel.
507 	 */
508 	if (t_or_u_flag && secpercyl != lp->d_secpercyl)
509 		fprintf(stderr, "%s (%d) %s (%lu)\n",
510 			"Warning: calculated sectors per cylinder", secpercyl,
511 			"disagrees with disk label", lp->d_secpercyl);
512 	if (maxbpg == 0)
513 		maxbpg = MAXBLKPG(bsize);
514 	headswitch = lp->d_headswitch;
515 	trackseek = lp->d_trkseek;
516 #ifdef notdef /* label may be 0 if faked up by kernel */
517 	bbsize = lp->d_bbsize;
518 	sbsize = lp->d_sbsize;
519 #endif
520 	oldpartition = *pp;
521 #ifdef tahoe
522 	realsectorsize = sectorsize;
523 	if (sectorsize != DEV_BSIZE) {		/* XXX */
524 		int secperblk = DEV_BSIZE / sectorsize;
525 
526 		sectorsize = DEV_BSIZE;
527 		nsectors /= secperblk;
528 		nphyssectors /= secperblk;
529 		secpercyl /= secperblk;
530 		fssize /= secperblk;
531 		pp->p_size /= secperblk;
532 	}
533 #endif
534 	mkfs(pp, special, fsi, fso);
535 #ifdef tahoe
536 	if (realsectorsize != DEV_BSIZE)
537 		pp->p_size *= DEV_BSIZE / realsectorsize;
538 #endif
539 	if (!Nflag)
540 		close(fso);
541 	close(fsi);
542 #ifdef MFS
543 	if (mfs) {
544 		struct mfs_args args;
545 
546 		sprintf(buf, "mfs:%d", getpid());
547 		args.fspec = buf;
548 		args.export.ex_root = -2;
549 		if (mntflags & MNT_RDONLY)
550 			args.export.ex_flags = MNT_EXRDONLY;
551 		else
552 			args.export.ex_flags = 0;
553 		args.base = membase;
554 		args.size = fssize * sectorsize;
555 
556 		vfc = getvfsbyname("mfs");
557 		if(!vfc && vfsisloadable("mfs")) {
558 			if(vfsload("mfs")) {
559 				err(1, "vfsload(mfs)");
560 			}
561 			endvfsent();	/* flush cache */
562 			vfc = getvfsbyname("mfs");
563 		}
564 
565 		if (mount(vfc ? vfc->vfc_index : MOUNT_MFS, argv[1], mntflags,
566 				&args) < 0)
567 			fatal("%s: %s", argv[1], strerror(errno));
568 		if(filename) {
569 			munmap(membase,fssize * sectorsize);
570 		}
571 	}
572 #endif
573 	exit(0);
574 }
575 
576 #ifdef COMPAT
577 char lmsg[] = "%s: can't read disk label; disk type must be specified";
578 #else
579 char lmsg[] = "%s: can't read disk label";
580 #endif
581 
582 struct disklabel *
583 getdisklabel(s, fd)
584 	char *s;
585 	int fd;
586 {
587 	static struct disklabel lab;
588 
589 	if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) {
590 #ifdef COMPAT
591 		if (disktype) {
592 			struct disklabel *lp, *getdiskbyname();
593 
594 			unlabeled++;
595 			lp = getdiskbyname(disktype);
596 			if (lp == NULL)
597 				fatal("%s: unknown disk type", disktype);
598 			return (lp);
599 		}
600 #endif
601 		warn("ioctl (GDINFO)");
602 		fatal(lmsg, s);
603 	}
604 	return (&lab);
605 }
606 
607 /*VARARGS*/
608 void
609 #if __STDC__
610 fatal(const char *fmt, ...)
611 #else
612 fatal(fmt, va_alist)
613 	char *fmt;
614 	va_dcl
615 #endif
616 {
617 	va_list ap;
618 
619 #if __STDC__
620 	va_start(ap, fmt);
621 #else
622 	va_start(ap);
623 #endif
624 	if (fcntl(STDERR_FILENO, F_GETFL) < 0) {
625 		openlog(progname, LOG_CONS, LOG_DAEMON);
626 		vsyslog(LOG_ERR, fmt, ap);
627 		closelog();
628 	} else {
629 		vwarnx(fmt, ap);
630 	}
631 	va_end(ap);
632 	exit(1);
633 	/*NOTREACHED*/
634 }
635 
636 usage()
637 {
638 	if (mfs) {
639 		fprintf(stderr,
640 		    "usage: %s [ -fsoptions ] special-device mount-point\n",
641 			progname);
642 	} else
643 		fprintf(stderr,
644 		    "usage: %s [ -fsoptions ] special-device%s\n",
645 		    progname,
646 #ifdef COMPAT
647 		    " [device-type]");
648 #else
649 		    "");
650 #endif
651 	fprintf(stderr, "where fsoptions are:\n");
652 	fprintf(stderr,
653 	    "\t-N do not create file system, just print out parameters\n");
654 	fprintf(stderr, "\t-O create a 4.3BSD format filesystem\n");
655 	fprintf(stderr, "\t-S sector size\n");
656 #ifdef COMPAT
657 	fprintf(stderr, "\t-T disktype\n");
658 #endif
659 	fprintf(stderr, "\t-a maximum contiguous blocks\n");
660 	fprintf(stderr, "\t-b block size\n");
661 	fprintf(stderr, "\t-c cylinders/group\n");
662 	fprintf(stderr, "\t-d rotational delay between contiguous blocks\n");
663 	fprintf(stderr, "\t-e maximum blocks per file in a cylinder group\n");
664 	fprintf(stderr, "\t-f frag size\n");
665 	fprintf(stderr, "\t-i number of bytes per inode\n");
666 	fprintf(stderr, "\t-k sector 0 skew, per track\n");
667 	fprintf(stderr, "\t-l hardware sector interleave\n");
668 	fprintf(stderr, "\t-m minimum free space %%\n");
669 	fprintf(stderr, "\t-n number of distinguished rotational positions\n");
670 	fprintf(stderr, "\t-o optimization preference (`space' or `time')\n");
671 	fprintf(stderr, "\t-p spare sectors per track\n");
672 	fprintf(stderr, "\t-s file system size (sectors)\n");
673 	fprintf(stderr, "\t-r revolutions/minute\n");
674 	fprintf(stderr, "\t-t tracks/cylinder\n");
675 	fprintf(stderr, "\t-u sectors/track\n");
676 	fprintf(stderr, "\t-x spare sectors per cylinder\n");
677 	exit(1);
678 }
679