efs(4)efs(4)NAMEefs - layout of the Extent File System
SYNOPSIS
#include <sys/param.h>
#include <sys/fs/efs.h>
DESCRIPTION
An Extent File System can reside on a regular disk partition or on a
logical volume; see lv(1M). The disk partition or volume is divided into
a certain number of 512-byte sectors, also called basic blocks. The
current maximum size limit of an Extent File System is 16777214 blocks,
equivalent to 8 gigabytes.
The Extent File System imposes a common format for certain vital
information on its underlying storage medium. Basic block 0 is unused
and is available to contain a bootstrap program or other information.
Basic block 1 is the superblock. The format of an Extent File System
superblock is:
/*
* Structure of the superblock for the Extent File System
*/
struct efs {
/*
* This portion is read off the volume
*/
long fs_size; /* size of filesystem, in sectors */
long fs_firstcg; /* bb offset to first cg */
long fs_cgfsize; /* size of cylinder group in bb's */
short fs_cgisize; /* bb's in inodes per cylinder group */
short fs_sectors; /* sectors per track */
short fs_heads; /* heads per cylinder */
short fs_ncg; /* # of groups in filesystem */
short fs_dirty; /* fs needs to be fsck'd */
time_t fs_time; /* last superblock update */
long fs_magic; /* magic number */
char fs_fname[6]; /* filesystem name */
char fs_fpack[6]; /* filesystem pack name */
long fs_bmsize; /* size of bitmap in bytes */
long fs_tfree; /* total free data blocks */
long fs_tinode; /* total free inodes */
long fs_bmblock; /* bitmap location */
long fs_replsb; /* location of replicated superblock. */
char fs_spare[24]; /* space for expansion */
long fs_checksum; /* checksum of volume portion of fs */
/*
* The remainder of this structure, defined fully in
* <sys/fs/efs_sb.h> is used by the operating system only.
*/
};
Page 1
efs(4)efs(4)
The struct efs that is defined in <sys/fs/efs_sb.h> contains more fields.
The extra fields are used internally by the operating system and are not
discussed here. If in doubt, consult the include file for any recent
changes to both the section discussed here and changes to relevant
definitions.
fs_size holds the size in basic blocks of the filesystem. This variable
is filled in when the filesystem is first created with mkfs(1M).
fs_firstcg contains the basic block offset to the first cylinder group.
There are fs_ncg cylinder groups contained in the filesystem. Each
cylinder group is composed of fs_cgfsize basic blocks, of which
fs_cgisize basic blocks are used for inodes.
fs_sectors and fs_heads are used to specify the geometry of the
underlying disk containing the filesystem. fs_heads is in fact currently
unused and should not be relied upon.
fs_dirty is a flag that indicates if the filesystem needs to be checked
by the fsck(1M) program.
The fs_time field contains the time stamp of when the filesystem was last
modified.
fs_name holds the name of the filesystem (where it is mounted, more or
less) and fs_fpack contains which volume this filesystem is. The
fs_fpack field is singularly useless, but is provided for utility
compatibility.
fs_magic is used to tag the superblock of the filesystem as an Extent
File System. There are two values that are currently used and a macro
used to test for either one.
#define EFS_MAGIC 0x072959
#define EFS_NEWMAGIC 0x07295A
#define IS_EFS_MAGIC(x) ((x == EFS_MAGIC) || (x == EFS_NEWMAGIC))
The NEWMAGIC version was added in IRIX 3.3 when the superblock format
changed slightly. Filesystems created with that version of mkfs or later
(or modified with mkfs -r or extended with growfs) get the new magic
number; otherwise the older magic number is retained, if present.
The fs_bmsize field contains, in bytes, the size of the data block
bitmap. The data block bitmap is used for data block allocation. Each
one in the bitmap indicates a free block.
The fs_bmblock field contains the location of the bitmap if it has been
moved from its default location (basic block 2) because the filesystem
has been constructed on a logical volume that has been extended (see
growfs(1M)).
Page 2
efs(4)efs(4)
fs_tfree and fs_tinode contain the total free blocks and inodes,
respectively.
The fs_replsb field contains the location of a replicated superblock, if
one exists.
The fs_spare field is reserved for future use.
Lastly, the fs_checksum variable holds a checksum of the above fields
(not including itself).
During the mount(1M) of the filesystem, the fs_dirty and fs_checksum
fields are examined. If fs_dirty is non-zero, or the fs_checksum
variable does not match the systems computed checksum, the filesystem
must be cleaned with fsck before it can be mounted. If the filesystem is
the root partition, this check is ignored, as it is necessary to be able
to run fsck on a dirty root from a dirty root. For the format of an
inode and its flags, see inode(4).
FILES
/usr/include/sys/fs/efs*.h
/usr/include/sys/stat.h
SEE ALSOfsck(1M), growfs(1M), mkfs(1M), inode(4).
Page 3