Merge commit 'dc97a43d4a70c8773a619f11b95b07a787f6f5b7' into merges
[unleashed.git] / share / man / man7fs / ufs.7fs
blob71f86c4812a86dbd24a4674a4658da55eaf82838
1 '\" te
2 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
5 .\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with
6 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH UFS 7FS "Jun 18, 2009"
8 .SH NAME
9 ufs \- UFS file system
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fB#include <sys/param.h>\fR
14 .fi
16 .LP
17 .nf
18 \fB#include <sys/types.h>\fR
19 .fi
21 .LP
22 .nf
23 \fB#include <sys/fs/ufs_fs.h>\fR
24 .fi
26 .LP
27 .nf
28 \fB#include <sys/fs/ufs_inode.h>\fR
29 .fi
31 .SH DESCRIPTION
32 .sp
33 .LP
34 \fBUFS\fR is the default disk-based file system for the Solaris environment.
35 The UFS file system is hierarchical, starting with its root directory (\fB/\fR)
36 and continuing downward through a number of directories. The root of a UFS file
37 system is \fBinode 2\fR. A UFS file system's root contents replace the contents
38 of the directory upon which it is mounted.
39 .sp
40 .LP
41 Subsequent sections of this manpage provide details of the UFS file systems.
42 .SS "State Flags (\fBfs_state\fR and \fBfs_clean\fR)"
43 .sp
44 .LP
45 UFS uses state flags to identify the state of the file system. \fBfs_state\fR
46 is \fBFSOKAY\fR - \fBfs_time\fR.  \fBfs_time\fR is the timestamp that indicates
47 when the last system write occurred. \fBfs_state\fR is updated whenever
48 \fBfs_clean\fR changes. Some \fBfs_clean\fR values are:
49 .sp
50 .ne 2
51 .na
52 \fB\fBFSCLEAN\fR\fR
53 .ad
54 .RS 12n
55 Indicates an undamaged, cleanly unmounted file system.
56 .RE
58 .sp
59 .ne 2
60 .na
61 \fB\fBFSACTIVE\fR\fR
62 .ad
63 .RS 12n
64 Indicates a mounted file system that has modified data in memory. A mounted
65 file system with this state flag indicates that user data or metadata would be
66 lost if power to the system is interrupted.
67 .RE
69 .sp
70 .ne 2
71 .na
72 \fB\fBFSSTABLE\fR\fR
73 .ad
74 .RS 12n
75 Indicates an idle mounted file system. A mounted file system with this state
76 flag indicates that neither user data nor metadata would be lost if power to
77 the system is interrupted.
78 .RE
80 .sp
81 .ne 2
82 .na
83 \fB\fBFSBAD\fR\fR
84 .ad
85 .RS 12n
86 Indicates that this file system contains inconsistent file system data.
87 .RE
89 .sp
90 .ne 2
91 .na
92 \fBFSLOG\fR
93 .ad
94 .RS 12n
95 Indicates that the file system has logging enabled. A file system with this
96 flag set is either mounted or unmounted. If a file system has logging enabled,
97 the only flags that it can have are \fBFSLOG\fR or \fBFSBAD\fR. A non-logging
98 file system can have \fBFSACTIVE\fR, \fBFSSTABLE\fR, or \fBFSCLEAN\fR.
99 .RE
103 It is not necessary to run the \fBfsck\fR command on unmounted file systems
104 with a state of \fBFSCLEAN\fR, \fBFSSTABLE\fR, or \fBFSLOG\fR. \fBmount\fR(2)
105 returns \fBENOSPC\fR if an attempt is made to mount a \fBUFS\fR file system
106 with a state of \fBFSACTIVE\fR for read/write access.
109 As an additional safeguard, \fBfs_clean\fR should be trusted only if
110 \fBfs_state\fR contains a value equal to \fBFSOKAY\fR - \fBfs_time\fR, where
111 \fBFSOKAY\fR is a constant integer defined in the
112 \fB/usr/include/sys/fs/ufs_fs.h\fR file.  Otherwise, \fBfs_clean\fR is treated
113 as though it contains the value of \fBFSACTIVE\fR.
114 .SS "Extended Fundamental Types  (\fBEFT\fR)"
117 Extended Fundamental Types (EFT) provide 32-bit user ID (UID), group ID (GID),
118 and device numbers.
121 If a UID or GID contains an extended value, the short variable (\fBic_suid\fR,
122 \fBic_sgid\fR) contains the value 65535 and the corresponding UID or GID is in
123 \fBic_uid\fR or \fBic_gid\fR. Because numbers for block and character devices
124 are stored in the first direct block pointer of the inode (\fBic_db[0]\fR) and
125 the disk block addresses are already 32 bit values, no special encoding exists
126 for device numbers (unlike UID or GID fields).
127 .SS "Multiterabyte File System"
130 A multiterabyte file system enables creation of a UFS file system up to
131 approximately 16 terabytes of usable space, minus approximately one percent
132 overhead. A sparse file can have a logical size of one terabyte. However, the
133 actual amount of data that can be stored in a file is approximately one percent
134 less than one terabyte because of file system overhead.
137 On-disk format changes for a multiterabyte UFS file system include:
138 .RS +4
140 .ie t \(bu
141 .el o
142 The magic number in the superblock changes from \fBFS_MAGIC\fR to
143 \fBMTB_UFS_MAGIC\fR. For more information, see the
144 \fB/usr/include/sys/fs/ufs_fs\fR file.
146 .RS +4
148 .ie t \(bu
149 .el o
150 The \fBfs_logbno\fR unit is a sector for UFS that is less than 1 terabyte in
151 size and fragments for a multiterabyte UFS file system.
153 .SS "UFS Logging"
156 UFS logging bundles the multiple metadata changes that comprise a complete UFS
157 operation into a transaction. Sets of transactions are recorded in an on-disk
158 log and are applied to the actual UFS file system's metadata.
161 UFS logging provides two advantages:
162 .RS +4
165 A file system that is consistent with the transaction log eliminates the
166 need to run \fBfsck\fR after a system crash or an unclean shutdown.
168 .RS +4
171 UFS logging often provides a significant performance improvement. This is
172 because a file system with logging enabled converts multiple updates to the
173 same data into single updates, thereby reducing the number of overhead disk
174 operations.
178 The UFS log is allocated from free blocks on the file system and is sized at
179 approximately 1 Mbyte per 1 Gbyte of file system, up to 256 Mbytes. The log
180 size may be larger (up to a maximum of 512 Mbytes), depending upon the number
181 of cylinder groups present in the file system. The log is continually flushed
182 as it fills up. The log is also flushed when the file system is unmounted or as
183 a result of a \fBlockfs\fR(8) command.
184 .SS "Mounting UFS File Systems"
187 You can mount a UFS file system in various ways using syntax similar to the
188 following:
189 .RS +4
192 Use \fBmount\fR from the command line:
194 .in +2
196 # mount -F ufs /dev/dsk/c0t0d0s7 /export/home
198 .in -2
202 .RS +4
205 Include an entry in the \fB/etc/vfstab\fR file to mount the file system at
206 boot time:
208 .in +2
210 /dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home  ufs   2   yes  -
212 .in -2
218 For more information on mounting UFS file systems, see \fBmount_ufs\fR(8).
219 .SH ATTRIBUTES
222 See \fBattributes\fR(5) for a description of the following attributes:
227 box;
228 c | c
229 l | l .
230 ATTRIBUTE TYPE  ATTRIBUTE VALUE
232 Interface Stability     Uncommitted
235 .SH SEE ALSO
238 \fBdf\fR(8), \fBfsck\fR(8), \fBfsck_ufs\fR(8), \fBfstyp\fR(8),
239 \fBlockfs\fR(8), \fBmkfs_ufs\fR(8), \fBnewfs\fR(8), \fBufsdump\fR(8),
240 \fBufsrestore\fR(8), \fBtunefs\fR(8), \fBmount\fR(2), \fBattributes\fR(5)
243 \fIWriting Device Drivers\fR
244 .SH NOTES
247 For information about internal UFS structures, see \fBnewfs\fR(8) and
248 \fBmkfs_ufs\fR(8). For information about the \fBufsdump\fR and
249 \fBufsrestore\fR commands, see \fBufsdump\fR(8), \fBufsrestore\fR(8), and
250 \fB/usr/include/protocols/dumprestore.h\fR.
253 If you experience difficulty in allocating space on the ufs filesystem, it may
254 be due to framentation. Fragmentation can occur when you do not have sufficient
255 free blocks to satisfy an allocation request even though \fBdf\fR(8) indicates
256 that enough free space is available. (This may occur because df only uses the
257 available fragment count to calculate available space, but the file system
258 requires contiguous sets of fragments for most allocations). If you suspect
259 that you have exhausted contiguous  fragments on  your file system, you can use
260 the \fBfstyp\fR(8) utility with the -v option. In the \fBfstyp\fR output,
261 look at the  \fInbfree\fR (number  of  blocks  free) and \fInffree\fR (number
262 of fragments free) fields. On unmounted filesystems, you can use \fBfsck\fR(8)
263 and observe  the  last line of output, which reports, among other items, the
264 number of fragments and the degree of fragmentation. To correct a fragmentation
265 problem, run \fBufsdump\fR(8) and \fBufsrestore\fR(8) on the ufs filesystem.