1fsck_ufs(1M) System Administration Commands fsck_ufs(1M)
2
3
4
6 fsck_ufs - file system consistency check and interactive repair
7
9 fsck -F ufs [generic-options] [special]...
10
11
12 fsck -F ufs [generic-options] [-o specific-options]
13 [special]...
14
15
17 The fsck utility audits and interactively repairs inconsistent condi‐
18 tions on file systems. A file system to be checked may be specified by
19 giving the name of the block or character special device or by giving
20 the name of its mount point if a matching entry exists in /etc/vfstab.
21
22
23 The special parameter represents the character special device, for
24 example, /dev/rdsk/c1t0d0s7, on which the file system resides. The
25 character special device, not the block special device should be used.
26 The fsck utility will not work if the block device is mounted, unless
27 the file system is error-locked.
28
29
30 If no special device is specified, all ufs file systems specified in
31 the vfstab with a fsckdev entry will be checked. If the -p (``preen'')
32 option is specified, ufs file systems with an fsckpass number greater
33 than 1 are checked in parallel. See fsck(1M).
34
35
36 In the case of correcting serious inconsistencies, by default, fsck
37 asks for confirmation before making a repair and waits for the operator
38 to respond either yes or no. If the operator does not have write per‐
39 mission on the file system, fsck will default to a -n (no corrections)
40 action. See fsck(1M).
41
42
43 Repairing some file system inconsistencies can result in loss of data.
44 The amount and severity of data loss can be determined from the diag‐
45 nostic output.
46
47
48 The fsck utility automatically corrects innocuous inconsistencies such
49 as unreferenced inodes, too-large link counts in inodes, missing blocks
50 in the free list, blocks appearing in the free list and also in files,
51 or incorrect counts in the super block. It displays a message for each
52 inconsistency corrected that identifies the nature of the correction on
53 the file system which took place. After successfully correcting a file
54 system, fsck prints the number of files on that file system, the number
55 of used and free blocks, and the percentage of fragmentation.
56
57
58 Inconsistencies checked include:
59
60 o Blocks claimed by more than one inode or the free list.
61
62 o Blocks claimed by an inode or the free list outside the
63 range of the file system.
64
65 o Incorrect link counts.
66
67 o Incorrect directory sizes.
68
69 o Bad inode format.
70
71 o Blocks not accounted for anywhere.
72
73 o Directory checks, file pointing to unallocated inode, inode
74 number out of range, and absence of `.' and `..' as the
75 first two entries in each directory.
76
77 o Super Block checks: more blocks for inodes than there are in
78 the file system.
79
80 o Bad free block list format.
81
82 o Total free block and/or free inode count incorrect.
83
84
85 Orphaned files and directories (allocated but unreferenced) are, with
86 the operator's concurrence, reconnected by placing them in the
87 lost+found directory. The name assigned is the inode number. If the
88 lost+found directory does not exist, it is created. If there is insuf‐
89 ficient space in the lost+found directory, its size is increased.
90
91
92 An attempt to mount a ufs file system with the -o nolargefiles option
93 will fail if the file system has ever contained a large file (a file
94 whose size is greater than or equal to 2 Gbyte). Invoking fsck resets
95 the file system state if no large files are present in the file system.
96 A successful mount of the file system after invoking fsck indicates the
97 absence of large files in the file system. An unsuccessful mount
98 attempt indicates the presence of at least one large file. See
99 mount_ufs(1M).
100
102 The generic-options consist of the following options:
103
104 -m Check but do not repair. This option checks that the file
105 system is suitable for mounting, returning the appropriate
106 exit status. If the file system is ready for mounting, fsck
107 displays a message such as:
108
109
110
111 ufs fsck: sanity check: /dev/rdsk/c0t3d0s1 okay
112
113
114
115 -n|N Assume a no response to all questions asked by fsck; do not
116 open the file system for writing.
117
118
119 -V Echo the expanded command line, but do not execute the com‐
120 mand. This option may be used to verify and to validate the
121 command line.
122
123
124 -v Enables verbose output. Might not be supported by all
125 filesystem-specific fsck implementations.
126
127
128 -y|Y Assume a yes response to all questions asked by fsck.
129
130
131
132 See generic fsck(1M) for the details for specifying special.
133
134 -o specific-options Specify ufs file system specific options. These
135 options can be any combination of the following
136 separated by commas (with no intervening spa‐
137 ces).
138
139 b=n Use block n as the super block for the
140 file system. Block 32 is always one of
141 the alternate super blocks. Determine the
142 location of other super blocks by running
143 newfs(1M) with the -Nv options specified.
144
145
146 f Force checking of file systems regardless
147 of the state of their super block clean
148 flag.
149
150
151 p Check and fix the file system non-inter‐
152 actively ("preen"). Exit immediately if
153 there is a problem requiring interven‐
154 tion. This option is required to enable
155 parallel file system checking.
156
157
158 w Check writable file systems only.
159
160
161
163 /etc/vfstab list of default parameters for each file system
164
165
167 See attributes(5) for descriptions of the following attributes:
168
169
170
171
172 ┌─────────────────────────────┬─────────────────────────────┐
173 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
174 ├─────────────────────────────┼─────────────────────────────┤
175 │Availability │SUNWcsu │
176 └─────────────────────────────┴─────────────────────────────┘
177
179 clri(1M), fsck(1M), fsdb_ufs(1M), fsirand(1M), fstyp(1M), mkfs(1M),
180 mkfs_ufs(1M), mount_ufs(1M), mountall(1M), newfs(1M), reboot(1M),
181 vfstab(4), attributes(5), largefile(5), ufs(7FS)
182
184 The operating system buffers file system data. Running fsck on a
185 mounted file system can cause the operating system's buffers to become
186 out of date with respect to the disk. For this reason, the file system
187 should be unmounted when fsck is used. If this is not possible, care
188 should be taken that the system is quiescent and that it is rebooted
189 immediately after fsck is run. Quite often, however, this will not be
190 sufficient. A panic will probably occur if running fsck on a file sys‐
191 tem modifies the file system.
192
194 It is usually faster to check the character special device than the
195 block special device.
196
197
198 Running fsck on file systems larger than 2 Gb fails if the user chooses
199 to use the block interface to the device:
200
201 fsck /dev/dsk/c?t?d?s?
202
203
204
205 rather than the raw (character special) device:
206
207 fsck /dev/rdsk/c?t?d?s?
208
209
210
211
212SunOS 5.11 2 Aug 2005 fsck_ufs(1M)