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