some random thoughts on mkfs

David Solan Kdavid at gizzmo.UUCP
Sun May 8 09:53:48 AEST 1988


I'd like to add my thoughts on the mkfs command that a few
people have been commenting on recently.

Mkfs is a forgiving command in terms of its error output -- but
it cannot do the impossible!  If you execute it with numeric
parameters which exceed the number of available blocks on the
diskette (or hard disk) in ANY way, or ask it to create any sort of
contradiction on the file system, and then use that floppy as a
mountable file system -- you will be sorrrrrrryyy!  It will appear
to work, but in fact you will be losing and rewriting data all over
the place, not to mention getting I/O errors.  A complete mess will
ensue.  Of course this mess will NOT ensue if all you do is use your
floppies for cpio -- cpio overwrites the inode table of contents
that mkfs creates.

If you just use mkfs by itself it KNOWS the maximums and correct
values and plugs them in for you automatically.  If it's any help,
the "physical" "block number" in mkfs is in 512 byte "blocks", which
hold 8 inodes, so adding 16 inodes means losing 2 "physical" data
blocks and vice versa (you can only go up or down 2 "blocks" or 16
inodes at a time).  However, keep in mind that the second argument
to mkfs ("blocks[:inodes]") is in a form where "blocks" means the
TOTAL blocks of the system, not just those used for data in the
filesystem (as opposed to those used for inodes).  Thus, this number
should STAY THE SAME no matter how many inodes you are creating.
You will see the difference in a df -t command, but for mkfs, the
number is always the same.

Furthermore, the "gap" and "blockock = 1024
total logical blocks = 415
total inodes = 144
gap (physical blocks) = 2
cylinder size (physical blocks) = 20 

In the first case above, a df -t command (on the mounted file system)
results in:

/mnt      (/dev/fp021):      812 blocks      94 i-nodes
 total:      830 blocks      96 i-nodes

 And, in the second case, a df -t command gives:

 /mnt      (/dev/fp021):      806 blocks     142 i-nodes
  total:      830 blocks     144 i-nodes

Keep It Short and Simple.

The 3.51 Utilities package has a detailed description of the mkfs
command in the UNIX System V User's Manual, Volume 1 -- look it
up!!!  ("when all else fails, read the directions").

	David  Solan
	Objective Programming Incorporated
	Post Office Box 123
	Norwalk,  CT  06856
	Voice: (203) 866-6900
	attmail: dsolan
	USENET: gizzmo!kdavid

-- 
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                                                {codas,u1100a}-----\
David Solan                            rutgers!rochester!pcid!kodak!gizzmo!mark
                                          {lazlo,ethos,fthood}-----/



More information about the Comp.sys.att mailing list