-.\" $OpenBSD: newfs.8,v 1.77 2020/05/18 06:20:44 otto Exp $
+.\" $OpenBSD: newfs.8,v 1.78 2021/06/03 06:42:03 otto Exp $
.\" $NetBSD: newfs.8,v 1.12 1995/03/18 14:58:41 cgd Exp $
.\"
.\" Copyright (c) 1983, 1987, 1991, 1993, 1994
.\"
.\" @(#)newfs.8 8.3 (Berkeley) 3/27/94
.\"
-.Dd $Mdocdate: May 18 2020 $
+.Dd $Mdocdate: June 3 2021 $
.Dt NEWFS 8
.Os
.Sh NAME
The expected average number of files per directory on the file system.
.It Fl i Ar bytes
This specifies the density of inodes in the file system.
-The default is to create an inode for every 4 fragments.
+The default is to create an inode for every 4 fragments,
+for 4k disks one inode for every 2 fragments.
If fewer inodes are desired, a larger number should be used;
to create more inodes a smaller number should be given.
.It Fl m Ar free-space
-/* $OpenBSD: newfs.c,v 1.114 2020/05/19 12:49:51 sthen Exp $ */
+/* $OpenBSD: newfs.c,v 1.115 2021/06/03 06:42:03 otto Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
const char *errstr;
long long fssize_input = 0;
int fssize_usebytes = 0;
+ int defaultfsize;
u_int64_t nsecs;
if (strstr(__progname, "mfs"))
fssize = nsecs * (sectorsize / DEV_BSIZE);
if (oflagset == 0 && fssize >= INT_MAX)
Oflag = 2; /* FFS2 */
+ defaultfsize = fsize == 0;
if (fsize == 0) {
fsize = DISKLABELV1_FFS_FSIZE(pp->p_fragblock);
if (fsize <= 0)
if (bsize <= 0)
bsize = MINIMUM(DFL_BLKSIZE, 8 * fsize);
}
- if (density == 0)
+ if (density == 0) {
density = NFPI * fsize;
+ /* large sectors lead to fewer inodes due to large fsize,
+ compensate */
+ if (defaultfsize && sectorsize > DEV_BSIZE)
+ density /= 2;
+ }
if (minfree < MINFREE && opt != FS_OPTSPACE && reqopt == -1) {
warnx("warning: changing optimization to space "
"because minfree is less than %d%%\n", MINFREE);