FS(4) FS(4)
NAME
Extent file system - layout of the Extent file system
SYNOPSIS
#include <sys/param.h>
#include <sys/fs.h>
DESCRIPTION
Every Extent file system storage volume has a common format
for certain vital information. Every such volume is divided
into a certain number of 512 byte long sectors, also called
basic blocks. Basic block 0 is unused and is available to
contain a bootstrap program or other information.
Basic block 1 is the super-block. The format of an Extent
file system super-block is:
/*
* Structure of the super-block for the Extent file system
*/
struct efs {
/*
* This portion is read off the volume
*/
long fs_size; /* size of file system, 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 file system */
short fs_dirty; /* fs needs to be fsck'd */
time_t fs_time; /* last super-block update */
char fs_fname[6]; /* file system name */
char fs_fpack[6]; /* file system pack name */
long fs_magic; /* magic number */
long fs_prealloc; /* a good file system pre-alloc size */
long fs_bmsize; /* size of bitmap in bytes */
long fs_tfree; /* total free data blocks */
long fs_tinode; /* total free inodes */
char fs_spare[100]; /* space for expansion */
long fs_checksum; /* checksum of volume portion of fs */
/*
* The remainder of this structure, defined fully in <sys/fs.h>
* is used by the operating system only.
*/
};
#define EFS_MAGIC 0x041755
Note that the struct efs that is defined in <sys/fs.h>
Page 1 (last mod. 8/20/87)
FS(4) FS(4)
contains more fields. The extra fields are used internally
by the operating system, and are not discussed here.
fs_size holds the size in basic blocks of the file system.
This variable is filled in when the file system 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 file system. 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 file system.
fs_dirty is a flag which indicates if the file system needs
to be checked by the fsck(1M) program. The fs_time field
contains the time stamp of when the file system was last
modified. fs_name holds the name of the file system (where
it is mounted, more or less) while fs_fpack contains which
volume this file system is. The fs_fpack field is
singularly useless, but is provided for utility
compatibility. fs_magic is used to tag the superblock of
the file system as an Extent file system. fs_prealloc is
sometimes used by the allocator for pre-allocation during
file writing and should indicate a particularly good pre-
allocation for the given file system. 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. fs_tfree and
fs_tinode contain the total free blocks and inodes,
respectively. 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 file system, 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, then the file system must be cleaned with
fsck before it can be mounted. If the file system is the
root partition, then 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).
CAVEATS
During the usage of an extent filesystem, several errors are
possible which are not possible on the bell filesystem.
Because the extent filesystem uses extents for all
allocation, it is possible that an extremely fragmented
filesystem will cause ``out of space'' messages before the
filesystem is actually full. A possible temporary solution
Page 2 (last mod. 8/20/87)
FS(4) FS(4)
to this problem is to write the filesystems data to tape,
then using mkfs(1) to clean the filesystem, then reading the
tape back in. We do not recommend this procedure for novice
users. Eventually a filesystem reorganizer will be
available which will solve this problem.
FILES
/usr/include/sys/fs.h
/usr/include/sys/stat.h
SEE ALSO
fsck(1M), mkfs(1M), inode(4), efsinode(4), bellfs(4).
ORIGIN
Silicon Graphics, Inc.
Page 3 (last mod. 8/20/87)