aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1995-02-05 08:42:31 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1995-02-05 08:42:31 +0000
commit55abc5794aad38a9d4468e1dfd27adfefeced9c4 (patch)
treec44b0d96ecc9b08f3c6e2bb7ec8dc5c030af3fc2 /sbin
parent0bc786d0764d8446b09ad62067a48fdaef36e17c (diff)
downloadsrc-55abc5794aad38a9d4468e1dfd27adfefeced9c4.tar.gz
src-55abc5794aad38a9d4468e1dfd27adfefeced9c4.zip
Change the defaults for newfs to disregard the geometry in the disklabel.
We pretend we have one head with two megabyte worth of sectors per cylinder. The code try to access another head in what it belives to the same physical cylinder, because it belives that it would be faster than waiting for the next free sector under this head to come around. Most modern drives doesn't have a "classical" geometry, and thus we end up fooling ourselves doing the above optimization. With this change we will fill a cylinder sequentially if we can, and thus get much more mileage from the track-buffer/cache built into the drives. As a result a lot of seeks to the next or previous track should be avoided by this. (My disk is a lot less noisy actually...) You can still get the old behaviour, by specifying zero for the numbers. This will also solve the problem with newfs barfing at really big drives. Obtained from: adult advice from Kirk.
Notes
Notes: svn path=/head/; revision=6192
Diffstat (limited to 'sbin')
-rw-r--r--sbin/newfs/newfs.87
-rw-r--r--sbin/newfs/newfs.c15
2 files changed, 18 insertions, 4 deletions
diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8
index e342516bc048..5ab5a595bca0 100644
--- a/sbin/newfs/newfs.8
+++ b/sbin/newfs/newfs.8
@@ -87,8 +87,7 @@ or
the disk must be labeled using
.Xr disklabel 8 .
.Nm Newfs
-builds a file system on the specified special device
-basing its defaults on the information in the disk label.
+builds a file system on the specified special device.
Typically the defaults are reasonable, however
.Nm newfs
has numerous options to allow the defaults to be selectively overridden.
@@ -232,9 +231,13 @@ The speed of the disk in revolutions per minute.
.It Fl t Ar #tracks/cylinder
The number of tracks/cylinder available for data allocation by the file
system.
+The default is 1.
+If zero is specified, the value from the disklabel will be used.
.It Fl u Ar sectors/track
The number of sectors per track available for data allocation by the file
system.
+The default is 4096.
+If zero is specified, the value from the disklabel will be used.
This does not include sectors reserved at the end of each track for bad
block replacement (see the
.Fl p
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index effb821f635f..cb6bf3594374 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -144,13 +144,24 @@ void fatal();
*/
#define NRPOS 1 /* number distinct rotational positions */
+/*
+ * About the same time as the above, we knew what went where on the disks.
+ * no longer so, so kill the code which finds the different platters too...
+ * We do this by saying one head, with a lot of sectors on it.
+ * The number of sectors are used to determine the size of a cyl-group.
+ * Kirk suggested one or two meg per "cylinder" so we say two.
+ */
+
+#define NTRACKS 1 /* number of heads */
+
+#define NSECTORS 4096 /* number of sectors */
int mfs; /* run as the memory based filesystem */
int Nflag; /* run without writing file system */
int Oflag; /* format as an 4.3BSD file system */
int fssize; /* file system size */
-int ntracks; /* # tracks/cylinder */
-int nsectors; /* # sectors/track */
+int ntracks = NTRACKS; /* # tracks/cylinder */
+int nsectors = NSECTORS; /* # sectors/track */
int nphyssectors; /* # sectors/track including spares */
int secpercyl; /* sectors per cylinder */
int trackspares = -1; /* spare sectors per track */