Visit Our UNIX and Linux User Community


fsck command - what does it check/repair??


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users fsck command - what does it check/repair??
# 1  
Old 04-05-2002
Question fsck command - what does it check/repair??

While rebooting one of the UNIX systems here at work, the boot-up process halted and a message appeared telling me that I had to run the fsck command. The command to the best of my knowledge went something like :
Code:
fsck -F ufs /dev/rdsk/c0t0d0s0

Can someone give me a full list of this command actually looks at and repairs. Is it just the blocks that it repairs or is it i-node values aswell??

Any information here would be most helpful!

Last edited by Yogesh Sawant; 04-10-2011 at 12:09 PM.. Reason: added code tags
# 2  
Old 04-05-2002
it checks inodes as well as other file-system structure details. I do not believe it does a physical scan (i.e. bad blocks), although that may depend on your particular OS version. At least under linux there is a separate tool for this (which can be called by fsck if you pass a certain flag)
# 3  
Old 04-05-2002
Here is the man page for fsck

Code:
man fsck
 fsck(1M)                                                           fsck(1M)
 NAME
      fsck (generic) - file system consistency check and interactive repair

 SYNOPSIS
      /usr/sbin/fsck [-F FSType] [-m] [-V] [special ...]
      /usr/sbin/fsck [-F FSType] [-o FSspecific-options] [-V] [special ...]
 
DESCRIPTION
      The fsck command audits and interactively repairs inconsistent
      conditions for HP-UX file systems on mass storage device files
      identified by special.  If the file system is consistent, the number of files on that file system and the number of used and free blocks are reported.  If the file system is inconsistent, fsck provides a mechanism to fix these inconsistencies, depending on which form of the fsck command is used.

      special represents a special device (e.g., /dev/rdsk/c1d0s8).
 
   Options
      fsck recognizes the following options:
           -F FStype      Specify the file system type on which to operate

                          (see fstyp(1M) and fs_wrapper(5)).  If this option
                          is not included on the command line, then the file
                          system type is determined from the file /etc/fstab
                          by matching special with an entry in that file.
                          If there is no entry in /etc/fstab, then the file
                          system type is determined from the file
                          /etc/default/fs.

           -m             Perform a sanity check only.  fsck will return 0
                          if the file system is suitable for mounting.  If
                          the file system needs additional checking, the
                          return code is 32.  If the file system is mounted,
                          the return code is 33.  Error codes larger than 33
                          indicate that the file system is badly damaged.

           -o FSspecific-options
                          Specify options specific to each file system type.
                          FSspecific-options is a list of suboptions and/or
                          keyword/attribute pairs intended for a file-
                          system-specific version of the command.  See the
                          file-system-specific manual entries for a
                          description of the specific_options supported, if
                          any.

           -V             Echo the completed command line, but perform no other action.  The command line is generated by incorporating the user-specified options and other information derived from /etc/fstab.  This option allows the user to verify the command line.

 RETURN VALUES
      The following values are returned by the -m option to fsck:
            0   Either no errors were detected or all errors were corrected.
           32   The file system needs additional checking.

           33   The file system is mounted.

      Return values greater that 33 indicate that file system is badly
      corrupted.  File system specific versions of fsck will have their own
      additional return values (see fsck_FSType(1M)).

 WARNINGS
      This command may not be supported for all file system types.

 FILES
      /etc/default/fs          Specifies the default file system type
      /etc/fstab               Default list of file systems to check

 STANDARDS CONFORMANCE
      fsck: SVID3

 SEE ALSO
      fsck_FSType(1M), mkfs(1M), newfs(1M), fstab(4), fs_wrapper(5).


Last edited by Yogesh Sawant; 04-10-2011 at 12:11 PM.. Reason: added code tags
# 4  
Old 04-13-2002
One other thing to rememebr about fsck (at least under Solaris) is that it's primary function is to maintain the integrity of the file system, not the data in the file system. Complete files that are "misplaced" will be put in lost+found, but partial files will be dropped.
# 5  
Old 04-15-2002
On Solaris 8

Is recommendable that you run the fsck from a boot cdrom.

at the maintenance prompt-> halt
at the prompt (ok) -> boot cdrom -s
then -> fsck -F ufs /dev/rdsk/c0t0d0s0

if you have a BAD SUPERBLOCK message->
newfs -Nv /dev/rdsk/c0t0d0s0
(to obtain the block numbers of the Superblock backup's)

select a backup block number in the middle of the previus
response.
then run ->

fsck -F ufs -ob=<backup_block_numer> /dev/rdsk/c0t0d0s0

Last edited by hugo_perez; 04-15-2002 at 08:48 PM..

Previous Thread | Next Thread
Test Your Knowledge in Computers #140
Difficulty: Easy
Unix and the C programming language were both developed at AT&T.
True or False?

8 More Discussions You Might Find Interesting

1. Solaris

Can I run repair on lot of blocks with single command ?

Hi, I have Solaris-10 OS on T5220. Both local disks were mirrored under SVM. Somehow when one disk gone bad (c0t1d0), other disk (c0t0d0) also got lot of bad block. We have readable data only on c0t0d0, but as soon as server comes after, it hangs when I run few commands because of read errors,... (1 Reply)
Discussion started by: solaris_1977
1 Replies

2. Shell Programming and Scripting

Command to check only Autosys running jobs with autorep like command

Hi, Is there any specific command to use to check only say Running jobs via autorep or similar command for Autosys? (0 Replies)
Discussion started by: sidnow
0 Replies

3. Solaris

Fsck command without any option

Dear all, I want to execute fsck command,can i execute fsck command without any option asking for more confidence. Thanks and Regards Monoj Das (1 Reply)
Discussion started by: monojcool
1 Replies

4. Solaris

unable to repair the / filesystem. Run fsck manually (fsck -F ufs /dev/rdsk/c1t0d0s0)

What can I fix this issue? I have ran below commands but everything is same.:confused: WARNING: Last shutdown is later than time on time-of-day chip: check date. The / file system (/dev/rdsk/c1t0d0s0) is being checked WARNING - unable to repair the / filesystem. Run fsck manually (fsck -F... (4 Replies)
Discussion started by: getrue
4 Replies

5. UNIX for Dummies Questions & Answers

fsck command

can somebody tell me what exactly fsck command does ? please dont post the man page for it I already read it (3 Replies)
Discussion started by: anandgodse
3 Replies

6. UNIX for Dummies Questions & Answers

How to repair DNS

I am using Mac OS X and my server keeps crashing every several hours or so. I have checked the log file at /var/log/system.log and the entries closest to the crash read Mar 15 22:27:23 server servermgrd: servermgr_dns: no name available via DNS for 192.168.84.21 Mar 15 22:27:23 server... (4 Replies)
Discussion started by: timgolding
4 Replies

7. HP-UX

fsck! How to run Full File System Check

Dear all I am new for HP-UX. I have HP rp2470 running HP-UX 10.x When i run fsck in a root, the output is as below: #:root> fsck fsck: /dev/vg00/rlvol1: mounted file system continue (y/n)? y ** /dev/vg00/rlvol1 ** Last Mounted on /stand ** Phase 1 - Check Blocks and Sizes ** Phase... (3 Replies)
Discussion started by: hungevntelecom
3 Replies

8. UNIX for Dummies Questions & Answers

File System Check (fsck)

I am having a problem with fsck. I am new to UNIX but was placed in a position where I must learn it. Anyway, one of the instructions that I have been given is to use 'fsck -f -y' when I am having trouble with the filesystem. The problem is that I am getting an error message that says the -f... (1 Reply)
Discussion started by: mawalton
1 Replies

Featured Tech Videos