newfs.c revision 77420
1230479Snetchild/*
2230479Snetchild * Copyright (c) 1983, 1989, 1993, 1994
3230479Snetchild *	The Regents of the University of California.  All rights reserved.
4230479Snetchild *
5230479Snetchild * Redistribution and use in source and binary forms, with or without
6230479Snetchild * modification, are permitted provided that the following conditions
7230479Snetchild * are met:
8230479Snetchild * 1. Redistributions of source code must retain the above copyright
9230479Snetchild *    notice, this list of conditions and the following disclaimer.
10230479Snetchild * 2. Redistributions in binary form must reproduce the above copyright
11230479Snetchild *    notice, this list of conditions and the following disclaimer in the
12230479Snetchild *    documentation and/or other materials provided with the distribution.
13230479Snetchild * 3. All advertising materials mentioning features or use of this software
14230479Snetchild *    must display the following acknowledgement:
15230479Snetchild *	This product includes software developed by the University of
16230479Snetchild *	California, Berkeley and its contributors.
17230479Snetchild * 4. Neither the name of the University nor the names of its contributors
18230479Snetchild *    may be used to endorse or promote products derived from this software
19230479Snetchild *    without specific prior written permission.
20230479Snetchild *
21230479Snetchild * 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
35static 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
42static char sccsid[] = "@(#)newfs.c	8.13 (Berkeley) 5/1/95";
43#endif
44static const char rcsid[] =
45  "$FreeBSD: head/sbin/newfs/newfs.c 77420 2001-05-29 19:40:39Z phk $";
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
80struct mntopt mopts[] = {
81	MOPT_STDOPTS,
82	MOPT_ASYNC,
83	{ NULL },
84};
85
86#if __STDC__
87void	fatal(const char *fmt, ...);
88#else
89void	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	1024
102#define	DFL_BLKSIZE	8192
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 22 cylinders
108 * per group, which seems to be the largest value allowed given
109 * all the other default values.
110 */
111#define	DESCPG		22	/* desired fs_cpg */
112
113/*
114 * Once upon a time...
115 *    ROTDELAY gives the minimum number of milliseconds to initiate
116 *    another disk transfer on the same cylinder. It is used in
117 *    determining the rotationally optimal layout for disk blocks
118 *    within a file; the default of fs_rotdelay is 4ms.
119 *
120 * ...but now we make this 0 to disable the rotdelay delay because
121 * modern drives with read/write-behind achieve higher performance
122 * without the delay.
123 */
124#define ROTDELAY	0
125
126/*
127 * MAXBLKPG determines the maximum number of data blocks which are
128 * placed in a single cylinder group. The default is one indirect
129 * block worth of data blocks.
130 */
131#define MAXBLKPG(bsize)	((bsize) / sizeof(daddr_t))
132
133/*
134 * Each file system has a number of inodes statically allocated.
135 * We allocate one inode slot per NFPI fragments, expecting this
136 * to be far more than we will ever need.
137 */
138#define	NFPI		4
139
140/*
141 * Once upon a time...
142 *    For each cylinder we keep track of the availability of blocks at different
143 *    rotational positions, so that we can lay out the data to be picked
144 *    up with minimum rotational latency.  NRPOS is the default number of
145 *    rotational positions that we distinguish.  With NRPOS of 8 the resolution
146 *    of our summary information is 2ms for a typical 3600 rpm drive.
147 *
148 * ...but now we make this 1 (which essentially disables the rotational
149 * position table because modern drives with read-ahead and write-behind do
150 * better without the rotational position table.
151 */
152#define	NRPOS		1	/* number distinct rotational positions */
153
154/*
155 * About the same time as the above, we knew what went where on the disks.
156 * no longer so, so kill the code which finds the different platters too...
157 * We do this by saying one head, with a lot of sectors on it.
158 * The number of sectors are used to determine the size of a cyl-group.
159 * Kirk suggested one or two meg per "cylinder" so we say two.
160 */
161#define NTRACKS		1	/* number of heads */
162#define NSECTORS	4096	/* number of sectors */
163
164int	Nflag;			/* run without writing file system */
165int	Oflag;			/* format as an 4.3BSD file system */
166int	Uflag;			/* enable soft updates for file system */
167int	fssize;			/* file system size */
168int	ntracks = NTRACKS;	/* # tracks/cylinder */
169int	nsectors = NSECTORS;	/* # sectors/track */
170int	nphyssectors;		/* # sectors/track including spares */
171int	secpercyl;		/* sectors per cylinder */
172int	trackspares = -1;	/* spare sectors per track */
173int	cylspares = -1;		/* spare sectors per cylinder */
174int	sectorsize;		/* bytes/sector */
175int	realsectorsize;		/* bytes/sector in hardware */
176int	rpm;			/* revolutions/minute of drive */
177int	interleave;		/* hardware sector interleave */
178int	trackskew = -1;		/* sector 0 skew, per track */
179int	headswitch;		/* head switch time, usec */
180int	trackseek;		/* track-to-track seek, usec */
181int	fsize = 0;		/* fragment size */
182int	bsize = 0;		/* block size */
183int	cpg = DESCPG;		/* cylinders/cylinder group */
184int	cpgflg;			/* cylinders/cylinder group flag was given */
185int	minfree = MINFREE;	/* free space threshold */
186int	opt = DEFAULTOPT;	/* optimization preference (space or time) */
187int	density;		/* number of bytes per inode */
188int	maxcontig = 0;		/* max contiguous blocks to allocate */
189int	rotdelay = ROTDELAY;	/* rotational delay between blocks */
190int	maxbpg;			/* maximum blocks per file in a cyl group */
191int	nrpos = NRPOS;		/* # of distinguished rotational positions */
192int	avgfilesize = AVFILESIZ;/* expected average file size */
193int	avgfilesperdir = AFPDIR;/* expected number of files per directory */
194int	bbsize = BBSIZE;	/* boot block size */
195int	sbsize = SBSIZE;	/* superblock size */
196int	mntflags = MNT_ASYNC;	/* flags to be passed to mount */
197int	t_or_u_flag = 0;	/* user has specified -t or -u */
198u_long	memleft;		/* virtual memory available */
199caddr_t	membase;		/* start address of memory based filesystem */
200char	*filename;
201#ifdef COMPAT
202char	*disktype;
203int	unlabeled;
204#endif
205
206char	device[MAXPATHLEN];
207char	*progname;
208
209extern void mkfs __P((struct partition *, char *, int, int));
210static void usage __P((void));
211static void rewritelabel __P((char *s, int fd, register struct disklabel *lp));
212
213int
214main(argc, argv)
215	int argc;
216	char *argv[];
217{
218	register int ch;
219	register struct partition *pp;
220	register struct disklabel *lp;
221	struct disklabel *getdisklabel();
222	struct partition oldpartition;
223	struct stat st;
224	struct statfs *mp;
225	int fsi, fso, len, n, vflag;
226	char *cp, *s1, *s2, *special, *opstring;
227
228	vflag = 0;
229	if ((progname = strrchr(*argv, '/')))
230		++progname;
231	else
232		progname = *argv;
233
234	opstring = "NOS:T:Ua:b:c:d:e:f:g:h:i:k:l:m:n:o:p:r:s:t:u:vx:";
235	while ((ch = getopt(argc, argv, opstring)) != -1)
236		switch (ch) {
237		case 'N':
238			Nflag = 1;
239			break;
240		case 'O':
241			Oflag = 1;
242			break;
243		case 'S':
244			if ((sectorsize = atoi(optarg)) <= 0)
245				fatal("%s: bad sector size", optarg);
246			break;
247#ifdef COMPAT
248		case 'T':
249			disktype = optarg;
250			break;
251#endif
252		case 'F':
253			filename = optarg;
254			break;
255		case 'U':
256			Uflag = 1;
257			break;
258		case 'a':
259			if ((maxcontig = atoi(optarg)) <= 0)
260				fatal("%s: bad maximum contiguous blocks",
261				    optarg);
262			break;
263		case 'b':
264			if ((bsize = atoi(optarg)) < MINBSIZE)
265				fatal("%s: bad block size", optarg);
266			break;
267		case 'c':
268			if ((cpg = atoi(optarg)) <= 0)
269				fatal("%s: bad cylinders/group", optarg);
270			cpgflg++;
271			break;
272		case 'd':
273			if ((rotdelay = atoi(optarg)) < 0)
274				fatal("%s: bad rotational delay", optarg);
275			break;
276		case 'e':
277			if ((maxbpg = atoi(optarg)) <= 0)
278		fatal("%s: bad blocks per file in a cylinder group",
279				    optarg);
280			break;
281		case 'f':
282			if ((fsize = atoi(optarg)) <= 0)
283				fatal("%s: bad fragment size", optarg);
284			break;
285		case 'g':
286			if ((avgfilesize = atoi(optarg)) <= 0)
287				fatal("%s: bad average file size", optarg);
288			break;
289		case 'h':
290			if ((avgfilesperdir = atoi(optarg)) <= 0)
291				fatal("%s: bad average files per dir", optarg);
292			break;
293		case 'i':
294			if ((density = atoi(optarg)) <= 0)
295				fatal("%s: bad bytes per inode", optarg);
296			break;
297		case 'k':
298			if ((trackskew = atoi(optarg)) < 0)
299				fatal("%s: bad track skew", optarg);
300			break;
301		case 'l':
302			if ((interleave = atoi(optarg)) <= 0)
303				fatal("%s: bad interleave", optarg);
304			break;
305		case 'm':
306			if ((minfree = atoi(optarg)) < 0 || minfree > 99)
307				fatal("%s: bad free space %%", optarg);
308			break;
309		case 'n':
310			if ((nrpos = atoi(optarg)) < 0)
311				fatal("%s: bad rotational layout count",
312				    optarg);
313			if (nrpos == 0)
314				nrpos = 1;
315			break;
316		case 'o':
317			if (strcmp(optarg, "space") == 0)
318				opt = FS_OPTSPACE;
319			else if (strcmp(optarg, "time") == 0)
320				opt = FS_OPTTIME;
321			else
322	fatal("%s: unknown optimization preference: 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), "%s%s", _PATH_DEV, special);
372		special = device;
373	}
374	if (Nflag) {
375		fso = -1;
376	} else {
377		fso = open(special, O_WRONLY);
378		if (fso < 0)
379			fatal("%s: %s", special, strerror(errno));
380
381		/* Bail if target special is mounted */
382		n = getmntinfo(&mp, MNT_NOWAIT);
383		if (n == 0)
384			fatal("%s: getmntinfo: %s", special, strerror(errno));
385
386		len = sizeof(_PATH_DEV) - 1;
387		s1 = special;
388		if (strncmp(_PATH_DEV, s1, len) == 0)
389			s1 += len;
390
391		while (--n >= 0) {
392			s2 = mp->f_mntfromname;
393			if (strncmp(_PATH_DEV, s2, len) == 0) {
394				s2 += len - 1;
395				*s2 = 'r';
396			}
397			if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0)
398				fatal("%s is mounted on %s",
399				    special, mp->f_mntonname);
400			++mp;
401		}
402	}
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)
409		printf("%s: %s: not a character-special device\n",
410		    progname, special);
411	cp = strchr(argv[0], '\0');
412	if (cp == argv[0])
413		fatal("null special file name");
414	cp--;
415	if (!vflag && (*cp < 'a' || *cp > 'h') && !isdigit(*cp))
416		fatal("%s: can't figure out file system partition",
417		    argv[0]);
418#ifdef COMPAT
419	if (disktype == NULL)
420		disktype = argv[1];
421#endif
422	lp = getdisklabel(special, fsi);
423	if (vflag || isdigit(*cp))
424		pp = &lp->d_partitions[0];
425	else
426		pp = &lp->d_partitions[*cp - 'a'];
427	if (pp->p_size == 0)
428		fatal("%s: `%c' partition is unavailable",
429		    argv[0], *cp);
430	if (pp->p_fstype == FS_BOOT)
431		fatal("%s: `%c' partition overlaps boot program",
432		      argv[0], *cp);
433	if (fssize == 0)
434		fssize = pp->p_size;
435	if (fssize > pp->p_size)
436	       fatal("%s: maximum file system size on the `%c' partition is %d",
437			argv[0], *cp, pp->p_size);
438	if (rpm == 0) {
439		rpm = lp->d_rpm;
440		if (rpm <= 0)
441			rpm = 3600;
442	}
443	if (ntracks == 0) {
444		ntracks = lp->d_ntracks;
445		if (ntracks <= 0)
446			fatal("%s: no default #tracks", argv[0]);
447	}
448	if (nsectors == 0) {
449		nsectors = lp->d_nsectors;
450		if (nsectors <= 0)
451			fatal("%s: no default #sectors/track", argv[0]);
452	}
453	if (sectorsize == 0) {
454		sectorsize = lp->d_secsize;
455		if (sectorsize <= 0)
456			fatal("%s: no default sector size", argv[0]);
457	}
458	if (trackskew == -1) {
459		trackskew = lp->d_trackskew;
460		if (trackskew < 0)
461			trackskew = 0;
462	}
463	if (interleave == 0) {
464		interleave = lp->d_interleave;
465		if (interleave <= 0)
466			interleave = 1;
467	}
468	if (fsize == 0) {
469		fsize = pp->p_fsize;
470		if (fsize <= 0)
471			fsize = MAX(DFL_FRAGSIZE, lp->d_secsize);
472	}
473	if (bsize == 0) {
474		bsize = pp->p_frag * pp->p_fsize;
475		if (bsize <= 0)
476			bsize = MIN(DFL_BLKSIZE, 8 * fsize);
477	}
478	/*
479	 * Maxcontig sets the default for the maximum number of blocks
480	 * that may be allocated sequentially. With filesystem clustering
481	 * it is possible to allocate contiguous blocks up to the maximum
482	 * transfer size permitted by the controller or buffering.
483	 */
484	if (maxcontig == 0)
485		maxcontig = MAX(1, MAXPHYS / bsize - 1);
486	if (density == 0)
487		density = NFPI * fsize;
488	if (minfree < MINFREE && opt != FS_OPTSPACE) {
489		fprintf(stderr, "Warning: changing optimization to space ");
490		fprintf(stderr, "because minfree is less than %d%%\n", MINFREE);
491		opt = FS_OPTSPACE;
492	}
493	if (trackspares == -1) {
494		trackspares = lp->d_sparespertrack;
495		if (trackspares < 0)
496			trackspares = 0;
497	}
498	nphyssectors = nsectors + trackspares;
499	if (cylspares == -1) {
500		cylspares = lp->d_sparespercyl;
501		if (cylspares < 0)
502			cylspares = 0;
503	}
504	secpercyl = nsectors * ntracks - cylspares;
505	/*
506	 * Only complain if -t or -u have been specified; the default
507	 * case (4096 sectors per cylinder) is intended to disagree
508	 * with the disklabel.
509	 */
510	if (t_or_u_flag && secpercyl != lp->d_secpercyl)
511		fprintf(stderr, "%s (%d) %s (%lu)\n",
512			"Warning: calculated sectors per cylinder", secpercyl,
513			"disagrees with disk label", (u_long)lp->d_secpercyl);
514	if (maxbpg == 0)
515		maxbpg = MAXBLKPG(bsize);
516	headswitch = lp->d_headswitch;
517	trackseek = lp->d_trkseek;
518#ifdef notdef /* label may be 0 if faked up by kernel */
519	bbsize = lp->d_bbsize;
520	sbsize = lp->d_sbsize;
521#endif
522	oldpartition = *pp;
523#ifdef tahoe
524	realsectorsize = sectorsize;
525	if (sectorsize != DEV_BSIZE) {		/* XXX */
526		int secperblk = DEV_BSIZE / sectorsize;
527
528		sectorsize = DEV_BSIZE;
529		nsectors /= secperblk;
530		nphyssectors /= secperblk;
531		secpercyl /= secperblk;
532		fssize /= secperblk;
533		pp->p_size /= secperblk;
534	}
535#else
536	realsectorsize = sectorsize;
537	if (sectorsize != DEV_BSIZE) {		/* XXX */
538		int secperblk = sectorsize / DEV_BSIZE;
539
540		sectorsize = DEV_BSIZE;
541		nsectors *= secperblk;
542		nphyssectors *= secperblk;
543		secpercyl *= secperblk;
544		fssize *= secperblk;
545		pp->p_size *= secperblk;
546	}
547#endif
548	mkfs(pp, special, fsi, fso);
549#ifdef tahoe
550	if (realsectorsize != DEV_BSIZE)
551		pp->p_size *= DEV_BSIZE / realsectorsize;
552#else
553	if (realsectorsize != DEV_BSIZE)
554		pp->p_size /= realsectorsize /DEV_BSIZE;
555#endif
556	if (!Nflag && bcmp(pp, &oldpartition, sizeof(oldpartition)))
557		rewritelabel(special, fso, lp);
558	if (!Nflag)
559		close(fso);
560	close(fsi);
561	exit(0);
562}
563
564#ifdef COMPAT
565char lmsg[] = "%s: can't read disk label; disk type must be specified";
566#else
567char lmsg[] = "%s: can't read disk label";
568#endif
569
570struct disklabel *
571getdisklabel(s, fd)
572	char *s;
573	int fd;
574{
575	static struct disklabel lab;
576
577	if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) {
578#ifdef COMPAT
579		if (disktype) {
580			struct disklabel *lp, *getdiskbyname();
581
582			unlabeled++;
583			lp = getdiskbyname(disktype);
584			if (lp == NULL)
585				fatal("%s: unknown disk type", disktype);
586			return (lp);
587		}
588#endif
589		warn("ioctl (GDINFO)");
590		fatal(lmsg, s);
591	}
592	return (&lab);
593}
594
595void
596rewritelabel(s, fd, lp)
597	char *s;
598	int fd;
599	register struct disklabel *lp;
600{
601#ifdef COMPAT
602	if (unlabeled)
603		return;
604#endif
605	lp->d_checksum = 0;
606	lp->d_checksum = dkcksum(lp);
607	if (ioctl(fd, DIOCWDINFO, (char *)lp) < 0) {
608		warn("ioctl (WDINFO)");
609		fatal("%s: can't rewrite disk label", s);
610	}
611}
612
613/*VARARGS*/
614void
615#if __STDC__
616fatal(const char *fmt, ...)
617#else
618fatal(fmt, va_alist)
619	char *fmt;
620	va_dcl
621#endif
622{
623	va_list ap;
624
625#if __STDC__
626	va_start(ap, fmt);
627#else
628	va_start(ap);
629#endif
630	if (fcntl(STDERR_FILENO, F_GETFL) < 0) {
631		openlog(progname, LOG_CONS, LOG_DAEMON);
632		vsyslog(LOG_ERR, fmt, ap);
633		closelog();
634	} else {
635		vwarnx(fmt, ap);
636	}
637	va_end(ap);
638	exit(1);
639	/*NOTREACHED*/
640}
641
642static void
643usage()
644{
645	fprintf(stderr,
646	    "usage: %s [ -fsoptions ] special-device%s\n",
647	    progname,
648#ifdef COMPAT
649	    " [device-type]");
650#else
651	    "");
652#endif
653	fprintf(stderr, "where fsoptions are:\n");
654	fprintf(stderr,
655	    "\t-N do not create file system, just print out parameters\n");
656	fprintf(stderr, "\t-O create a 4.3BSD format filesystem\n");
657	fprintf(stderr, "\t-S sector size\n");
658#ifdef COMPAT
659	fprintf(stderr, "\t-T disktype\n");
660#endif
661	fprintf(stderr, "\t-U enable soft updates\n");
662	fprintf(stderr, "\t-a maximum contiguous blocks\n");
663	fprintf(stderr, "\t-b block size\n");
664	fprintf(stderr, "\t-c cylinders/group\n");
665	fprintf(stderr, "\t-d rotational delay between contiguous blocks\n");
666	fprintf(stderr, "\t-e maximum blocks per file in a cylinder group\n");
667	fprintf(stderr, "\t-f frag size\n");
668	fprintf(stderr, "\t-g average file size\n");
669	fprintf(stderr, "\t-h average files per directory\n");
670	fprintf(stderr, "\t-i number of bytes per inode\n");
671	fprintf(stderr, "\t-k sector 0 skew, per track\n");
672	fprintf(stderr, "\t-l hardware sector interleave\n");
673	fprintf(stderr, "\t-m minimum free space %%\n");
674	fprintf(stderr, "\t-n number of distinguished rotational positions\n");
675	fprintf(stderr, "\t-o optimization preference (`space' or `time')\n");
676	fprintf(stderr, "\t-p spare sectors per track\n");
677	fprintf(stderr, "\t-s file system size (sectors)\n");
678	fprintf(stderr, "\t-r revolutions/minute\n");
679	fprintf(stderr, "\t-t tracks/cylinder\n");
680	fprintf(stderr, "\t-u sectors/track\n");
681	fprintf(stderr,
682        "\t-v do not attempt to determine partition name from device name\n");
683	fprintf(stderr, "\t-x spare sectors per cylinder\n");
684	exit(1);
685}
686