*BSD News Article 65930


Return to BSD News archive

Newsgroups: comp.bugs.2bsd
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!paladin.american.edu!gatech!europa.chnt.gtegsc.com!wlbr!moe!sms
From: sms@moe.2bsd.com (Steven M. Schultz)
Subject: mkfs overallocates inodes in some filesystems (#315)
Organization: 2BSD, Simi Valley CA USA
Message-ID: <DpsGnt.DG3@moe.2bsd.com>
Date: Sat, 13 Apr 1996 06:57:29 GMT
Lines: 1037

Subject: mkfs overallocates inodes in some filesystems (#315)
Index:	etc/mkfs,newfs.c 2.11BSD

Description:
	Mkfs is allocating 1 inode per 1600 bytes of diskspace.  This was
	causing problems with the 4mb root filesystem used by the 'generic'
	(distribution) system.

Repeat-By:
	Assuming you have a spare/scratch partition:
	
	newfs -s 8192 /dev/rra8a
	df -i /dev/rra8a
Filesystem  1K-blocks     Used    Avail Capacity iused   ifree  %iused  Mounted 
/dev/rra8a       3931        2     3929     0%       3    2605     0%   

	After the changes below are made the results will be:

# newfs -i 4096 -s 8192 /dev/rra8a
# df -i /dev/rra8a
Filesystem  1K-blocks     Used    Avail Capacity iused   ifree  %iused  Mounted 
/dev/rra8a       4030        2     4028     0%       3    1021     0%   

	A net gain of 100kb on a 4mb filesystem.  For the case of the 'generic'
	(distribution) root filesystem this is a significant gain.

	Oh - if you don't have a spare partition:  by observation.

	The kernel won't let you zap existing filesystems if the secure level
	is 1 or higher (the raw device can't be written if the corresponding
	block device is mounted - good thing too;-)).

Fix:
	Both newfs(8) and mkfs(8) now accept the "-i nnn" option to allow
	specification of the number of bytes of disk space for each inode.
	The default is 4096 (8 sectors).   This allocates ~1000 inodes for
	a 4mb root filesystem and ~2000 inodes for the common 8mb root fs.

	mkfs(8) uses a regular option syntax now - there are no more position
	dependent parameters, all options are real switches now.  The old
	syntax of "mkfs /dev/xxx size m n" will not be recognized.

	mkfs(8) should almost never be run manually.  The '-s size' argument
	differs between 'newfs' and 'mkfs'.  'Newfs' uses units of SECTORS
	"-s 8192" is what to tell 'newfs' when creating a 4mb filesystem.
	'Newfs' converts sectors to filesystem (logical) blocks before
	invoking 'mkfs'.  'Mkfs' deals with FILESYSTEM-BLOCKS, so if you were
	to use 'mkfs' to create a 4mb filesystem you would use "-s 4096".

	The manpages for mkfs(8) and newfs(8) were updated to reflect the
	options.

	Also, the setup documentation was edited to include the new question
	that the standalone version of 'mkfs' will ask.

	To install the update cut where indicated, saving to a file (/tmp/315).
	Then:

		cd /tmp
		patch -p0 < /tmp/315
		cd /usr/src/etc
		make mkfs newfs
		install -m 755 -o bin -g bin -s mkfs newfs /etc
		cd /usr/src/man/man8
		/usr/man/manroff mkfs.8 > /usr/man/cat8/mkfs.0
		/usr/man/manroff newfs.8 > /usr/man/cat8/newfs.0
		rm /tmp/315

	This and previous updates (assuming this one doesn't get cancelled by
	cancel-bots on the Net) are available via anonymous FTP to either
	FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the directory /pub/2.11BSD

--------------------------cut here-----------------------
*** /usr/src/etc/mkfs.c.old	Mon Jun 12 21:47:18 1995
--- /usr/src/etc/mkfs.c	Fri Apr 12 22:57:21 1996
***************
*** 1,9 ****
! char	*sccsid = "@(#)mkfs.c	2.8 1995/06/12";
  
  /*
!  * Make a file system.  Normally run by 'newfs' and not directly by users.
!  * usage: mkfs filsys size [ m n ]
   */
  #include <sys/param.h>
  /*
   * Need to do the following to get the larger incore inode structure
--- 1,17 ----
! #if	!defined(lint) && defined(DOSCCS)
! char	*sccsid = "@(#)mkfs.c	2.8 (2.11BSD) 1996/04/11";
! #endif
  
  /*
!  * Make a file system.  Run by 'newfs' and not directly by users.
!  * usage: mkfs -s size -i byte/ino -n num -m num filsys
!  *
!  * NOTE:  the size is specified in filesystem (1k) blocks NOT sectors.
!  *	  newfs does the conversion before running mkfs - if you run mkfs
!  *	  manually beware that the '-s' option means sectors to newfs but
!  *	  filesystem blocks to mkfs!
   */
+ 
  #include <sys/param.h>
  /*
   * Need to do the following to get the larger incore inode structure
***************
*** 15,23 ****
  #include <sys/file.h>
  #include <sys/dir.h>
  #include <sys/stat.h>
  #ifndef STANDALONE
  #include <stdio.h>
- #include <sys/fs.h>
  #include <sys/inode.h>
  #else
  #include "saio.h"
--- 23,33 ----
  #include <sys/file.h>
  #include <sys/dir.h>
  #include <sys/stat.h>
+ #include <sys/fs.h>
+ 
  #ifndef STANDALONE
+ #include <stdlib.h>
  #include <stdio.h>
  #include <sys/inode.h>
  #else
  #include "saio.h"
***************
*** 24,30 ****
  #endif
  
  #define	UMASK	0755
- #define	NIPB	(DEV_BSIZE/sizeof(struct dinode))
  #define	MAXFN	500
  
  time_t	utime;
--- 34,39 ----
***************
*** 33,38 ****
--- 42,48 ----
  int	fin;
  char	module[] = "Mkfs";
  extern	char	*ltoa();
+ extern	long	atol();
  extern	struct	iob	iob[];
  #endif
  
***************
*** 50,82 ****
  	char pad2[DEV_BSIZE];
  } filsys;
  
  int	f_n	= 100;
  int	f_m	= 2;
  
  	daddr_t	alloc();
  
- extern	long	atol();
- 
  main(argc,argv)
! int	argc;
! char	**argv;
  {
! register int f, c;
  	long n;
! register char *size;
  #ifdef	STANDALONE
  	struct	disklabel *lp;
! 	struct	partition *pp;
  	struct	iob	*io;
  #endif
  
  #ifndef STANDALONE
  	time(&utime);
! 	if(argc < 3) {
! 		printf("usage: mkfs filsys proto/size [ m n ]\n");
! 		exit(1);
! 	}
! 	size = argv[2];
  /*
   * NOTE: this will fail if the device is currently mounted and the system
   * is at securelevel 1 or higher.
--- 60,114 ----
  	char pad2[DEV_BSIZE];
  } filsys;
  
+ u_int	f_i	= 4096;		/* bytes/inode default */
  int	f_n	= 100;
  int	f_m	= 2;
  
  	daddr_t	alloc();
  
  main(argc,argv)
! 	int	argc;
! 	char	**argv;
  {
! register int c;
  	long n;
! 	char *size = 0;
! 	char	*special;
  #ifdef	STANDALONE
  	struct	disklabel *lp;
! register struct	partition *pp;
  	struct	iob	*io;
  #endif
  
  #ifndef STANDALONE
  	time(&utime);
! 	while	((c = getopt(argc, argv, "i:m:n:s:")) != EOF)
! 		{
! 		switch	(c)
! 			{
! 			case	'i':
! 				f_i = atoi(optarg);
! 				break;
! 			case	'm':
! 				f_m = atoi(optarg);
! 				break;
! 			case	'n':
! 				f_n = atoi(optarg);
! 				break;
! 			case	's':
! 				size = optarg;
! 				break;
! 			default:
! 				usage();
! 				break;
! 			}
! 		}
! 	argc -= optind;
! 	argv += optind;
! 	if	(argc != 1 || !size || !f_i || !f_m || !f_n)
! 		usage();
! 	special = *argv;
! 
  /*
   * NOTE: this will fail if the device is currently mounted and the system
   * is at securelevel 1 or higher.
***************
*** 85,100 ****
   * done so and invoked us.  This program should not be run manually unless
   * you are absolutely sure you know what you are doing - use 'newfs' instead.
  */
! 	fso = creat(argv[1], 0666);
! 	if(fso < 0) {
! 		printf("%s: cannot create\n", argv[1]);
! 		exit(1);
! 	}
! 	fsi = open(argv[1], 0);
! 	if(fsi < 0) {
! 		printf("%s: cannot open\n", argv[1]);
! 		exit(1);
! 	}
  #else
  /*
   * Something more modern than January 1, 1970 - the date that the new 
--- 117,128 ----
   * done so and invoked us.  This program should not be run manually unless
   * you are absolutely sure you know what you are doing - use 'newfs' instead.
  */
! 	fso = creat(special, 0666);
! 	if	(fso < 0)
! 		err(1, "cannot create %s\n", special);
! 	fsi = open(special, 0);
! 	if	(fsi < 0)
! 		err(1, "cannot open %s\n", special);
  #else
  /*
   * Something more modern than January 1, 1970 - the date that the new 
***************
*** 161,236 ****
  		strcpy(size, ltoa(dbtofsb(pp->p_size)));
  	if	(pp->p_size && atol(size) > pp->p_size)
  		{
! 		printf("specified size is larger than the disklabel says.\n");
  		return;
  		}
  	printf("interleaving factor (m; %d default): ", f_m);
  	gets(buf);
! 	if (buf[0])
  		f_m = atoi(buf);
  	if	(lp->d_secpercyl)
  		f_n = dbtofsb(lp->d_secpercyl);
  	printf("interleaving modulus (n; %d default): ", f_n);
  	gets(buf);
! 	if (buf[0])
  		f_n = atoi(buf);
  
! 	if(f_n <= 0 || f_n >= MAXFN)
  		f_n = MAXFN;
! 	if(f_m <= 0 || f_m > f_n)
  		f_m = 3;
! 	argc = 0;
! #endif
! 	n = 0;
! 	for(f=0; c=size[f]; f++) {
! 		if(c<'0' || c>'9') {
! 			printf("%s: size has nondigit\n", size);
! 			exit(1);
! 		}
! 		n = n*10 + (c-'0');
! 	}
! 	filsys.fs.fs_fsize = n;
  	if	(!n)
  		{
  		printf("Can't make zero length filesystem\n");
  		return;
  		}
! 	/*
! 	 * Minor hack for standalone root and other
! 	 * small filesystems: reduce ilist size.
! 	 */
! 	if (n <= 5000/CLSIZE)
! 		n = n/50;
! 	else
! 		n = n/25;
! 	if(n <= 0)
  		n = 1;
! 	if(n > 65500/NIPB)
! 		n = 65500/NIPB;
  	filsys.fs.fs_isize = n + 2;
! 	printf("isize = %D\n", n*NIPB);
  
- 	if(argc >= 5) {
- 		f_m = atoi(argv[3]);
- 		f_n = atoi(argv[4]);
- 		if(f_n <= 0 || f_n >= MAXFN)
- 			f_n = MAXFN;
- 		if(f_m <= 0 || f_m > f_n)
- 			f_m = 3;
- 	}
  	filsys.fs.fs_step = f_m;
  	filsys.fs.fs_cyl = f_n;
  	printf("m/n = %d %d\n", f_m, f_n);
! 	if(filsys.fs.fs_isize >= filsys.fs.fs_fsize) {
  		printf("%D/%D: bad ratio\n", filsys.fs.fs_fsize, filsys.fs.fs_isize-2);
  		exit(1);
! 	}
  	filsys.fs.fs_tfree = 0;
  	filsys.fs.fs_tinode = 0;
  	bzero(buf, DEV_BSIZE);
! 	for(n=2; n!=filsys.fs.fs_isize; n++) {
  		wtfs(n, buf);
! 		filsys.fs.fs_tinode += NIPB;
  	}
  
  	bflist();
--- 189,257 ----
  		strcpy(size, ltoa(dbtofsb(pp->p_size)));
  	if	(pp->p_size && atol(size) > pp->p_size)
  		{
! 		printf("specified size larger than disklabel says.\n");
  		return;
  		}
+ 	printf("bytes per inode [%u]: ", f_i);
+ 	gets(buf);
+ 	if	(buf[0])
+ 		f_i = atoi(buf);
  	printf("interleaving factor (m; %d default): ", f_m);
  	gets(buf);
! 	if	(buf[0])
  		f_m = atoi(buf);
  	if	(lp->d_secpercyl)
  		f_n = dbtofsb(lp->d_secpercyl);
  	printf("interleaving modulus (n; %d default): ", f_n);
  	gets(buf);
! 	if	(buf[0])
  		f_n = atoi(buf);
+ #endif
  
! 	if	(f_n <= 0 || f_n >= MAXFN)
  		f_n = MAXFN;
! 	if	(f_m <= 0 || f_m > f_n)
  		f_m = 3;
! 
! 	n = atol(size);
  	if	(!n)
  		{
  		printf("Can't make zero length filesystem\n");
  		return;
  		}
! 	filsys.fs.fs_fsize = n;
! 
! /*
!  * Calculate number of blocks of inodes as follows:
!  *
!  *	dbtob(n) = # of bytes in the filesystem
!  *	dbtob(n) / f_i = # of inodes to allocate
!  *	(dbtob(n) / f_i) / INOPB = # of fs blocks of inodes
!  *	
!  * Pretty - isn't it?
! */
! 	n = (dbtob(n) / f_i) / INOPB;
! 	if	(n <= 0)
  		n = 1;
! 	if	(n > 65500/INOPB)
! 		n = 65500/INOPB;
  	filsys.fs.fs_isize = n + 2;
! 	printf("isize = %D\n", n*INOPB);
  
  	filsys.fs.fs_step = f_m;
  	filsys.fs.fs_cyl = f_n;
  	printf("m/n = %d %d\n", f_m, f_n);
! 	if	(filsys.fs.fs_isize >= filsys.fs.fs_fsize)
! 		{
  		printf("%D/%D: bad ratio\n", filsys.fs.fs_fsize, filsys.fs.fs_isize-2);
  		exit(1);
! 		}
  	filsys.fs.fs_tfree = 0;
  	filsys.fs.fs_tinode = 0;
  	bzero(buf, DEV_BSIZE);
! 	for	(n=2; n!=filsys.fs.fs_isize; n++) {
  		wtfs(n, buf);
! 		filsys.fs.fs_tinode += INOPB;
  	}
  
  	bflist();
***************
*** 260,266 ****
  
  fsinit()
  {
! 	int i;
  
  	/*
  	 * initialize the node
--- 281,287 ----
  
  fsinit()
  {
! 	register int i;
  
  	/*
  	 * initialize the node
***************
*** 368,374 ****
  bfree(bno)
  daddr_t bno;
  {
! 	int i;
  
  	if (bno != 0)
  		filsys.fs.fs_tfree++;
--- 389,395 ----
  bfree(bno)
  daddr_t bno;
  {
! 	register int i;
  
  	if (bno != 0)
  		filsys.fs.fs_tfree++;
***************
*** 419,425 ****
  iput(ip)
  register struct inode *ip;
  {
! 	struct	dinode	buf[NIPB];
  	register struct dinode *dp;
  	daddr_t d;
  
--- 440,446 ----
  iput(ip)
  register struct inode *ip;
  {
! 	struct	dinode	buf[INOPB];
  	register struct dinode *dp;
  	daddr_t d;
  
***************
*** 438,440 ****
--- 459,470 ----
  	dp->di_ic2 = ip->i_ic2;
  	wtfs(d, buf);
  }
+ 
+ #ifndef	STANDALONE
+ usage()
+ 	{
+ 	printf("usage: [-s size] [-i bytes/ino] [-n num] [-m num] special\n");
+ 	exit(1);
+ 	/* NOTREACHED */
+ 	}
+ #endif
*** /usr/src/etc/newfs.c.old	Wed Apr 26 17:46:48 1995
--- /usr/src/etc/newfs.c	Fri Apr 12 20:49:00 1996
***************
*** 11,17 ****
  "@(#) Copyright (c) 1983 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)newfs.c	6.1 (2.11BSD) 4/26/95";
  #endif
  
  /*
--- 11,17 ----
  "@(#) Copyright (c) 1983 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)newfs.c	6.2 (2.11BSD) 1996/4/12";
  #endif
  
  /*
***************
*** 33,39 ****
--- 33,41 ----
  #include <sys/file.h>
  
  #include <ctype.h>
+ #include <errno.h>
  #include <paths.h>
+ #include <stdlib.h>
  #include <syslog.h>
  #include <varargs.h>
  
***************
*** 44,52 ****
  	int	Nflag;
  	struct	disklabel *getdisklabel();
  
! extern	char	*optarg, *__progname;
! extern	long	atol();
! extern	int	optind, errno;
  
  main(argc, argv)
  	int	argc;
--- 46,52 ----
  	int	Nflag;
  	struct	disklabel *getdisklabel();
  
! extern	char	*__progname;
  
  main(argc, argv)
  	int	argc;
***************
*** 56,69 ****
  	register struct partition	*pp;
  	char	*cp;
  	struct stat	st;
! 	long	fssize;
! 	int	ch, status, logsec, m;
  	int	fsi;
  	char	device[MAXPATHLEN], cmd[BUFSIZ], *index(), *rindex();
  	char	*special;
  
! 	m = 0;
! 	while ((ch = getopt(argc,argv,"T:Nvm:s:")) != EOF)
  		switch((char)ch) {
  		case 'N':
  		case 'v':
--- 56,70 ----
  	register struct partition	*pp;
  	char	*cp;
  	struct stat	st;
! 	long	fssize, ltmp;
! 	int	f_n = 0, f_m = 0;
! 	u_int	f_i = 4096;
! 	int	ch, status, logsec;
  	int	fsi;
  	char	device[MAXPATHLEN], cmd[BUFSIZ], *index(), *rindex();
  	char	*special;
  
! 	while ((ch = getopt(argc,argv,"T:Nvm:s:n:i:")) != EOF)
  		switch((char)ch) {
  		case 'N':
  		case 'v':
***************
*** 75,82 ****
  			break;
  #endif
  		case 'm':
! 			m = atoi(optarg);
  			break;
  		case 's':
  			fssize = atol(optarg);
  			if (fssize <= 0)
--- 76,102 ----
  			break;
  #endif
  		case 'm':
! 			ltmp = atol(optarg);
! 			if	(ltmp <= 0 || ltmp > 32)
! 				fatal("%s: out of 1 - 32 range", optarg);
! 			f_m = (int)ltmp;
  			break;
+ 		case	'n':
+ 			ltmp = atol(optarg);
+ /*
+  * If the upper bound is changed here then mkfs.c must also be changed
+  * also else mkfs will cap the value to its limit.
+ */
+ 			if	(ltmp <= 0 || ltmp > 500)
+ 				fatal("%s: out of 1 - 500 range", optarg);
+ 			f_n = (int)ltmp;
+ 			break;
+ 		case	'i':
+ 			ltmp = atol(optarg);
+ 			if	(ltmp < 512 || ltmp > 65536L)
+ 				fatal("%s: out of 512 - 65536 range", optarg);
+ 			f_i = (u_int)ltmp;
+ 			break;
  		case 's':
  			fssize = atol(optarg);
  			if (fssize <= 0)
***************
*** 156,165 ****
  	fssize /= logsec;
  
  	/* build command */
! 	if (m <= 0 || m > 31)
! 		m = 2;
! 	sprintf(cmd, "/etc/mkfs %s %ld %d %d", special, fssize, m,
! 	    	lp->d_secpercyl / logsec);
  	printf("newfs: %s\n", cmd);
  
  	close(fsi);
--- 176,188 ----
  	fssize /= logsec;
  
  	/* build command */
! 	if	(f_m == 0)	/* If never specified then use default of 2 */
! 		f_m = 2;
! 	if	(f_n == 0)	/* If never specified then 1/2 the cyl size */
! 		f_n = lp->d_secpercyl / logsec;
! 
! 	sprintf(cmd, "/etc/mkfs -m %d -n %d -i %u -s %ld %s", f_m, f_n, f_i,
! 		fssize, special);
  	printf("newfs: %s\n", cmd);
  
  	close(fsi);
***************
*** 209,214 ****
--- 232,238 ----
  
  	fprintf(stderr,"usage: %s [-N] [-m freelist-gap] [-s filesystem size] ",
  		__progname);
+ 	fprintf(stderr, "[-i bytes/inode] [-n freelist-modulus] ");
  #ifdef	COMPAT
  	fputs("[-T disk-type] ", stderr);
  #endif
*** /usr/src/man/man8/mkfs.8.old	Thu May 17 10:23:07 1990
--- /usr/src/man/man8/mkfs.8	Fri Apr 12 21:30:04 1996
***************
*** 2,16 ****
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)mkfs.8	5.0 (Berkeley) 8/13/87
  .\"
! .TH MKFS 8
  .UC 2
  .SH NAME
  mkfs \- construct a file system
  .SH SYNOPSIS
  .B /etc/mkfs
! special size  [ m ] [ n ]
  .SH DESCRIPTION
  .B N.B.:
  file systems are normally created with the
--- 2,28 ----
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)mkfs.8	2.0 (2.11BSD) 1996/4/12
  .\"
! .TH MKFS 8 "April 12, 1996"
  .UC 2
  .SH NAME
  mkfs \- construct a file system
  .SH SYNOPSIS
  .B /etc/mkfs
! [
! .B \-i bytes
! ]
! [
! .B \-s size
! ]
! [
! .B \-m gap
! ]
! [
! .B \-n modulus
! ]
! .B special
  .SH DESCRIPTION
  .B N.B.:
  file systems are normally created with the
***************
*** 21,50 ****
  constructs a file system
  by writing on the special file
  .IR special .
! The numeric
  .I size
! specifies the number of logical blocks in the file system (logical blocks
! are 1K on 2.10BSD.)  The number of inodes is calculated as a function of
! the filsystem size.  The
! .I lost+found
! directory is created but the boot block is left uninitialized (see
! .IR newfs (8).)
  .PP
! The optional flags \fIm\fP and \fIn\fP determine the block interleaving
  of the freelist that will be constructed,
! where \fIm\fP is the distance between successive 1024-byte blocks,
! and \fIn\fP is the number of blocks before the pattern repeats,
  typically one cylinder.
  The optimal values for
  these parameters vary with the speed and geometry of the disk,
! as well as the speed of the processor.
! .IR Newfs (8)
! automates the selection of these parameters in most cases.
  .SH "SEE ALSO"
  fs(5),
  dir(5),
  fsck(8),
  mkproto(8)
  newfs(8)
  .SH BUGS
  There should be some way to specify links.
--- 33,89 ----
  constructs a file system
  by writing on the special file
  .IR special .
! The size of the filesystem in logical blocks is specified by the 
! \fB\-s\fP
  .I size
! option.
! Logical blocks are 1K (2 sectors) under 2.11BSD.
  .PP
! .in +0.5i
! \fBNOTE:\fP The 
! .BR newfs (8)
! program's \fB\-s\fP option is in units of \fBsectors\fP.    
! .BR Newfs (8)
! converts this to filesystem (logical) blocks for
! .BR mkfs (8) .
! .br
! .in -0.5i
! .PP
! The number of inodes is calculated based on the argument
! .I bytes
! to the 
! .B \-i
! option.  The default is 4096.  If more inodes are desired in a filesystem
! (there is an absolute maximum of 65500) then a lower value for \fIbytes\fP
! should be used, perhaps 3072 or even 2048.
! .PP
! The flags 
! .B \-m
! .I gap
! and
! .B \-n
! .I modulus
! determine the block interleaving
  of the freelist that will be constructed,
! where \fIgap\fP is the distance between successive 1024-byte blocks,
! and \fImodulus\fP is the number of blocks before the pattern repeats,
  typically one cylinder.
  The optimal values for
  these parameters vary with the speed and geometry of the disk,
! as well as the speed of the processor.  
! .BR Newfs (8)
! will calculate the correct values in almost all cases from the disklabel.
  .SH "SEE ALSO"
  fs(5),
  dir(5),
+ disklabel(8),
  fsck(8),
  mkproto(8)
  newfs(8)
  .SH BUGS
  There should be some way to specify links.
+ .PP
+ The
+ .I lost+found
+ directory is created but the boot block is left uninitialized (see
+ .BR disklabel (8).)
*** /usr/src/man/man8/newfs.8.old	Tue May  2 21:34:53 1995
--- /usr/src/man/man8/newfs.8	Fri Apr 12 21:53:13 1996
***************
*** 2,10 ****
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)newfs.8	7.1 (2.11BSD) 1995/05/02
  .\"
! .TH NEWFS 8 "May 2, 1995"
  .UC 5
  .SH NAME
  newfs \- construct a new file system
--- 2,10 ----
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)newfs.8	2.0 (2.11BSD) 1996/04/12
  .\"
! .TH NEWFS 8 "April 12, 1996"
  .UC 5
  .SH NAME
  newfs \- construct a new file system
***************
*** 17,22 ****
--- 17,28 ----
  .B \-m free-gap
  ]
  [
+ .B \-n free-modulus
+ ]
+ [
+ .B \-i bytes
+ ]
+ [
  .B \-s size
  ]
  [
***************
*** 24,74 ****
  ]
  .B special
  .SH DESCRIPTION
! .I Newfs
  is a ``friendly'' front-end to the
! .IR mkfs (8)
  program.
! .I Newfs
  will normally read the disklabel from the drive to determine the 
  partition sizes.  If the driver for the disk does not support 
  disklabels the \-T option must be used to force a search of
  .IR /etc/disktab
  for partition information about \fIdrive-type\fP.
! .I Newfs
  calculates the appropriate parameters to use in calling
! .IR mkfs ,
! then builds the file system by forking \fImkfs\fP.
  .PP
! The
! .I \-N
! option causes the file system parameters to be printed out
! without actually creating the file system.
  .PP
! The
! .I \-m
! option allows the specification of the block interleaving of the free list
! (the
! .I m
! parameter of 
! .IR mkfs ).
! If not specified or outside the range 0 thru 31 then 
! .I m
! is given a value of 2.
! The 
! .I n
! parameter to 
! .I mkfs
! is calcuated by
! .I newfs
! to be 1 cylinder in size.
  .PP
! The
! .I \-T
! option must be used if the disk specified by \fIspecial\fP has not
  been labeled with the
! .IR disklabel (8)
  program.  In this case \fIdisk-type\fP is used by 
! .IR getdisklabel (3)
  when searching
  .IR /etc/disktab .
  This option is used when the underlying device driver does not
--- 30,78 ----
  ]
  .B special
  .SH DESCRIPTION
! .B Newfs
  is a ``friendly'' front-end to the
! .BR mkfs (8)
  program.
! .BR Newfs (8)
  will normally read the disklabel from the drive to determine the 
  partition sizes.  If the driver for the disk does not support 
  disklabels the \-T option must be used to force a search of
  .IR /etc/disktab
  for partition information about \fIdrive-type\fP.
! .B Newfs
  calculates the appropriate parameters to use in calling
! .BR mkfs ,
! then builds the file system by forking \fBmkfs\fP.
  .PP
! .B \-N
! causes the \fBmkfs\fP command which would be executed to be printed out
! without actually creating the file system.  The disk specified by \fBspecial\fP
! must be online though so that \fBnewfs\fP can read the disklabel.
  .PP
! .B \-m
! allows the specification of the block interleaving of the free list.
! If not specified or outside the range 1 thru 32 then 
! a value of 2 is used.
  .PP
! .B \-n
! parameter is the freelist modulus (when the \fB\-m\fP pattern repeats)
! and is calculated by
! .B newfs
! to be 1 cylinder in size by default.
! .PP
! .B \-i
! specifies how many bytes per inode to assume when calculating how many
! inodes to allocate.  The default is 4096 bytes per inode.  If this results
! in too few inodes being allocated (there is an absolute maximum of 65500)
! then decrease the \fIbytes\fP number (which must lie between 512 and 65536).
! .PP
! .B \-T
! must be used if the disk specified by \fIspecial\fP has not
  been labeled with the
! .BR disklabel (8)
  program.  In this case \fIdisk-type\fP is used by 
! .BR getdisklabel (3)
  when searching
  .IR /etc/disktab .
  This option is used when the underlying device driver does not
***************
*** 75,90 ****
  support disklabels.  Care must be taken that the contents of
  /etc/disktab match the partition tables in the kernel.
  .PP
! The
! .IR \-s
! option specifies how many \fBsectors\fP the file system is to contain.
  There are two sectors per file system block, therefore \fIsize\fP should
  be even.
  This parameter must be less than or equal to the partition size (as 
  determined from the disklabel or /etc/disktab).  An error is printed and
  no action is taken if the partition size is 0 or too large.
  .SH FILES
! /etc/disktab	for disk geometry and file system partition information 
  .br
  /etc/mkfs	to actually build the file system
  .SH "SEE ALSO"
--- 79,98 ----
  support disklabels.  Care must be taken that the contents of
  /etc/disktab match the partition tables in the kernel.
  .PP
! .BR \-s
! specifies how many \fBsectors\fP the file system is to contain.
  There are two sectors per file system block, therefore \fIsize\fP should
  be even.
  This parameter must be less than or equal to the partition size (as 
  determined from the disklabel or /etc/disktab).  An error is printed and
  no action is taken if the partition size is 0 or too large.
+ .PP
+ .in +0.5i
+ .B NOTE:
+ Mkfs deals in units of filesystem blocks not sectors.  Newfs uses sectors.
+ .in -0.5i
  .SH FILES
! /etc/disktab	disk geometry and partition information 
  .br
  /etc/mkfs	to actually build the file system
  .SH "SEE ALSO"
***************
*** 91,100 ****
  getdisklabel(3), disklabel(8), disktab(5), diskpart(8), fs(5), fsck(8),
  mkfs(8)
  .SH BUGS
! .IR newfs (8)
  no longer places boot blocks on the filesystem.  That duty has been 
  moved to the 
! .IR disklabel (8)
  program.  If you must place a boot block on a disk whose driver does
  not support disklabels use 
! .IR dd (1).
--- 99,108 ----
  getdisklabel(3), disklabel(8), disktab(5), diskpart(8), fs(5), fsck(8),
  mkfs(8)
  .SH BUGS
! .BR newfs (8)
  no longer places boot blocks on the filesystem.  That duty has been 
  moved to the 
! .BR disklabel (8)
  program.  If you must place a boot block on a disk whose driver does
  not support disklabels use 
! .BR dd (1).
*** /usr/doc/2.10/setup.2.11/2.t.old	Mon Jul 10 22:44:47 1995
--- /usr/doc/2.10/setup.2.11/2.t	Fri Apr 12 22:09:00 1996
***************
*** 2,8 ****
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)2.t	1.7 (GTE) 1995/06/13
  .\"
  .ds lq ``
  .ds rq ''
--- 2,8 ----
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)2.t	1.8 (GTE) 1996/04/12
  .\"
  .ds lq ``
  .ds rq ''
***************
*** 261,266 ****
--- 261,273 ----
  These numbers determine the layout of the free list that will be constructed;
  the proper interleaving will help increase the speed of the file system.
  .PP
+ The number of bytes per inode determines how many inodes will be allocated
+ in the filesystem.  The default of 4096 bytes per inode is normally enough
+ (resulting in about 2000 inodes for a 8mb root filesystem and 1000 inodes
+ for the 4mb distribution ``generic'' root filesystem).  If more inodes are
+ desired then a lower value (perhaps 3072) should be specified when prompted
+ for the number of bytes per inode.
+ .PP
  Then run the standalone version of the \fImkfs\fP (8) program.
  The values in square brackets at the size prompt is the default from 
  the disklabel.  Simply hit a return to accept the default.  \fImkfs\fP
***************
*** 276,281 ****
--- 283,289 ----
  \fBMkfs\fP
  \fBfile system:\fP \fIdk\|\fP(0,0)	(root is the first file system on drive 0)
  \fBfile system size:\fP [NNNN] \fIsize\fP	(count of 1024 byte blocks in root)
+ \fBbytes per inode:\fP [4096] \fIbytes\fP	(number of bytes per inode)
  \fBinterleaving factor (m, 2 default):\fP \fIm\fP	(interleaving, see above)
  \fBinterleaving modulus (n, 127 default):\fP \fIn\fP	(interleaving, see above)
  \fBisize = XX\fP	(count of inodes in root file system)
*** /VERSION.old	Thu Apr 11 19:41:56 1996
--- /VERSION	Fri Apr 12 22:29:42 1996
***************
*** 1,4 ****
! Current Patch Level: 314
  
  2.11 BSD
  ============
--- 1,4 ----
! Current Patch Level: 315
  
  2.11 BSD
  ============