File Systems ufs(7FS)
NAME
ufs - UFS file system
SYNOPSIS
#include
#include
#include
#include
DESCRIPTION
UFS is the default disk-based file system for the Solaris
environment. The UFS file system is hierarchical, starting
with its root directory (/) and continuing downward through
a number of directories. The root of a UFS file system is
inode 2. A UFS file system's root contents replace the con-
tents of the directory upon which it is mounted.
Subsequent sections of this manpage provide details of the
UFS file systems.
State Flags (fsstate and fsclean)
UFS uses state flags to identify the state of the file sys-
tem. fsstate is FSOKAY - fstime. fstime is the timestamp
that indicates when the last system write occurred. fsstate
is updated whenever fsclean changes. Some fsclean values
are:
FSCLEAN Indicates an undamaged, cleanly unmounted file
system.
FSACTIVE Indicates a mounted file system that has modi-
fied data in memory. A mounted file system with
this state flag indicates that user data or
metadata would be lost if power to the system is
interrupted.
FSTABLE Indicates an idle mounted file system. A mounted
file system with this state flag indicates that
neither user data nor metadata would be lost if
power to the system is interrupted.
SunOS 5.11 Last change: 25 Jun 2003 1
File Systems ufs(7FS)
FSBAD Indicates that this file system contains incon-
sistent file system data.
FSLOG Indicates that the file system has logging
enabled. A file system with this flag set is
either mounted or unmounted. If a file system
has logging enabled, the only flags that it can
have are FSLOG or FSBAD. A non-logging file sys-
tem can have FSACTIVE, FSTABLE, or FSCLEAN.
It is not necessary to run the fsck command on unmounted
file systems with a state of FSCLEAN, FSTABLE, or FSLOG.
mount(2) returns ENOSPC if an attempt is made to mount a UFS
file system with a state of FSACTIVE for read/write access.
As an additional safeguard, fsclean should be trusted only
if fsstate contains a value equal to FSOKAY - fstime,
where FSOKAY is a constant integer defined in the
/usr/include/sys/fs/ufsfs.h file. Otherwise, fsclean is
treated as though it contains the value of FSACTIVE.
Extended Fundamental Types (EFT)
Extended Fundamental Types (EFT) provide 32-bit user ID
(UID), group ID (GID), and device numbers.
If a UID or GID contains an extended value, the short vari-
able (icsuid, icsgid) contains the value 65535 and the
corresponding UID or GID is in icuid or icgid. Because
numbers for block and character devices are stored in the
first direct block pointer of the inode (icdb[0]) and the
disk block addresses are already 32 bit values, no special
encoding exists for device numbers (unlike UID or GID
fields).
Multiterabyte File System
A multiterabyte file system enables creation of a UFS file
system up to approximately 16 terabytes of usable space,
minus approximately one percent overhead. A sparse file can
have a logical size of one terabyte. However, the actual
amount of data that can be stored in a file is approximately
one percent less than one terabyte because of file system
overhead.
On-disk format changes for a multiterabyte UFS file system
include:
SunOS 5.11 Last change: 25 Jun 2003 2
File Systems ufs(7FS)
o The magic number in the superblock changes from
FSMAGIC to MTBUFSMAGIC. For more information,
see the /usr/include/sys/fs/ufsfs file.
o The fslogbno unit is a sector for UFS that is less
than 1 terabyte in size and fragments for a mul-
titerabyte UFS file system.
UFS Logging
UFS logging bundles the multiple metadata changes that
comprise a complete UFS operation into a transaction. Sets
of transactions are recorded in an on-disk log and are
applied to the actual UFS file system's metadata.
UFS logging provides two advantages:
1. A file system that is consistent with the transac-
tion log eliminates the need to run fsck after a
system crash or an unclean shutdown.
2. UFS logging often provides a significant perfor-
mance improvement. This is because a file system
with logging enabled converts multiple updates to
the same data into single updates, thereby reducing
the number of overhead disk operations.
The UFS log is allocated from free blocks on the file sys-
tem, and is sized at approximately 1 Mbyte per 1 Gbyte of
file system, up to a maximum of 64 Mbytes. The log is con-
tinually flushed as it fills up. The log is also flushed
when the file system is unmounted or as a result of a lockfs
command.
Mounting UFS File Systems
You can mount a UFS file system in various ways using syntax
similar to the following:
1. Use mount from the command line:
# mount -F ufs /dev/dsk/c0t0d0s7 /export/home
2. Include an entry in the /etc/vfstab file to mount
the file system at boot time:
/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs 2 yes -
SunOS 5.11 Last change: 25 Jun 2003 3
File Systems ufs(7FS)
For more information on mounting UFS file systems, see
mountufs(1M).
ATRIBUTES
See attributes(5) for a description of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Unstable
SEE ALSO
df(1M), fsck(1M), fsckufs(1M), fstyp(1M), mkfsufs(1M),
newfs(1M), ufsdump(1M), ufsrestore(1M), tunefs(1M),
mount(2), attributes(5)
Writing Device Drivers
NOTES
For information about internal UFS structures, see newfs(1M)
and mkfsufs(1M). For information about the ufsdump and
ufsrestore commands, see ufsdump(1M), ufsrestore(1M), and
/usr/include/protocols/dumprestore.h.
If you experience difficulty in allocating space on the ufs
filesystem, it may be due to framentation. Fragmentation can
occur when you do not have sufficient free blocks to satisfy
an allocation request even though df(1M) indicates that
enough free space is available. (This may occur because df
only uses the available fragment count to calculate avail-
able space, but the file system requires contiguous sets of
fragments for most allocations). If you suspect that you
have exhausted contiguous fragments on your file system,
you can use the fstyp(1M) utility with the -v option. In the
fstyp output, look at the nbfree (number of blocks free)
and nffree (number of fragments free) fields. On unmounted
filesystems, you can use fsck(1M) and observe the last
line of output, which reports, among other items, the number
of fragments and the degree of fragmentation. To correct a
fragmentation problem, run ufsdump(1M) and ufsrestore(1M) on
the ufs filesystem.
SunOS 5.11 Last change: 25 Jun 2003 4
|