1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-24 07:40:52 +00:00

Update the default newfs block and fragment sizes from 8192/1024 to

16384/2048.

Following recent discussions on the -arch mailing list, involving dillon
and mckusick, this change parallels the one made over a decade ago when
the default was bumped up from 4096/512.

This should provide significant performance improvements for most
folks, less significant performance losses for a few folks and
wasted space lost to large fragments for many folks.

For discussion, please see the following thread in the -arch archive:

Subject: Using a larger block size on large filesystems

The discussion ceases to be relevant when the issue of partitioning
schemes is raised.
This commit is contained in:
Sheldon Hearn 2001-12-11 16:21:40 +00:00
parent 5f4a79e5fe
commit 3626f83327
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=87661
5 changed files with 30 additions and 16 deletions

View File

@ -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 ,

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}