diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8 index c655fb0a1ae7..aefc95dcec78 100644 --- a/sbin/newfs/newfs.8 +++ b/sbin/newfs/newfs.8 @@ -110,7 +110,7 @@ See for more details on how to set this option. .It Fl b Ar block-size The block size of the file system, in bytes. It must be a power of 2. The -default size is 8192 bytes, and the smallest allowable size is 4096 bytes. +default size is 16384 bytes, and the smallest allowable size is 4096 bytes. The optimal block:fragment ratio is 8:1. Other ratios are possible, but are not recommended, and may produce unpredictable results. @@ -141,7 +141,7 @@ ranging in value between .Ar blocksize Ns /8 and .Ar blocksize . -The default is 1024 bytes. +The default is 2048 bytes. .It Fl g Ar avgfilesize The expected average file size for the file system. .It Fl h Ar avgfpdir @@ -271,15 +271,19 @@ This option is of historical importance only. Modern disks perform their own bad sector allocation. .El .Sh EXAMPLES -.Dl newfs -b 16384 -f 2048 /dev/ad3s1a +.Dl newfs /dev/ad3s1a .Pp Creates a new ufs file system on .Pa ad3s1a . .Nm will use a block size of 16384 bytes, a fragment size of 2048 bytes and the largest possible number of cylinders per group. -These values tend to produce better performance than the defaults -for most applications. +These values tend to produce better performance for most applications +than the historical defaults +(8192 byte block size and 1024 byte fragment size). +This large fragment size +may lead to large amounts of wasted space +on filesystems that contain a large number of small files. .Sh SEE ALSO .Xr fdformat 1 , .Xr disktab 5 , diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index c34fcb671666..8764a87fdc64 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -98,8 +98,8 @@ void fatal(); * sectorsize <= DESFRAGSIZE <= DESBLKSIZE * DESBLKSIZE / DESFRAGSIZE <= 8 */ -#define DFL_FRAGSIZE 1024 -#define DFL_BLKSIZE 8192 +#define DFL_FRAGSIZE 2048 +#define DFL_BLKSIZE 16384 /* * Cylinder groups may have up to many cylinders. The actual diff --git a/share/man/man7/tuning.7 b/share/man/man7/tuning.7 index f79ee5b783e8..de26e8a39528 100644 --- a/share/man/man7/tuning.7 +++ b/share/man/man7/tuning.7 @@ -199,19 +199,29 @@ and .Pp .Fx performs best when using 8K or 16K filesystem block sizes. -The default filesystem block size is 8K. -For larger partitions it is usually a good -idea to use a 16K block size. -This also requires you to specify a larger +The default filesystem block size is 16K, +which provides best performance for most applications, +with the exception of those that perform random access on large files +(such as database server software). +Such applications tend to perform better with a smaller block size, +although modern disk characteristics are such that the performance +gain from using a smaller block size may not be worth consideration. +Using a block size larger than 16K +can cause fragmentation of the buffer cache and +lead to lower performance. +.Pp +The defaults may be unsuitable +for a filesystem that requires a very large number of inodes +or is intended to hold a large number of very small files. +Such a filesystem should be created with an 8K or 4K block size. +This also requires you to specify a smaller fragment size. We recommend always using a fragment size that is 1/8 the block size (less testing has been done on other fragment size factors). The .Xr newfs 8 options for this would be -.Dq Li "newfs -f 2048 -b 16384 ..." . -Using a larger block size can cause fragmentation of the buffer cache and -lead to lower performance. +.Dq Li "newfs -f 1024 -b 8192 ..." . .Pp If a large partition is intended to be used to hold fewer, larger files, such as a database files, you can increase the diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 6371f803b216..108064fd296b 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/install.c @@ -1121,7 +1121,7 @@ installVarDefaults(dialogMenuItem *self) variable_set2(SYSTEM_STATE, "update", 0); else variable_set2(SYSTEM_STATE, "init", 0); - variable_set2(VAR_NEWFS_ARGS, "-b 8192 -f 1024", 0); + variable_set2(VAR_NEWFS_ARGS, "-b 16384 -f 2048", 0); variable_set2(VAR_CONSTERM, "NO", 0); return DITEM_SUCCESS; } diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index 6371f803b216..108064fd296b 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/sysinstall/install.c @@ -1121,7 +1121,7 @@ installVarDefaults(dialogMenuItem *self) variable_set2(SYSTEM_STATE, "update", 0); else variable_set2(SYSTEM_STATE, "init", 0); - variable_set2(VAR_NEWFS_ARGS, "-b 8192 -f 1024", 0); + variable_set2(VAR_NEWFS_ARGS, "-b 16384 -f 2048", 0); variable_set2(VAR_CONSTERM, "NO", 0); return DITEM_SUCCESS; }