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