Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
FSCK_LFS(8)		  BSD System Manager's Manual		   FSCK_LFS(8)

     fsck_lfs -- Log-structured	File System consistency	check and interactive

     fsck_lfs [-dfpqU] [-b block] [-m mode] [-y	| -n] filesystem ...

     fsck_lfs performs interactive filesystem consistency checks and repair
     for each of the filesystems specified on the command line.	 It is nor-
     mally invoked from	fsck(8).

     The design	of LFS takes care that no filesystem inconsistencies can hap-
     pen unless	hardware or software failures intervene.  fsck_lfs will	report
     and optionally correct any	such inconsistencies.

     For each corrected	inconsistency one or more lines	will be	printed	iden-
     tifying the filesystem on which the correction will take place, and the
     nature of the correction.	After successfully correcting a	filesystem,
     fsck_lfs will print the number of files on	that filesystem, the number of
     used and free blocks, and the percentage of fragmentation.

     If	sent a QUIT signal, fsck_lfs will finish the filesystem	checks,	then
     exit with an abnormal return status.

     Without the -p option, fsck_lfs audits and	interactively repairs incon-
     sistent conditions	for filesystems.  If the filesystem is inconsistent,
     the operator is prompted for concurrence before each correction is	at-
     tempted.  It should be noted that some of the corrective actions will re-
     sult in some loss of data.	 The amount and	severity of data lost may be
     determined	from the diagnostic output.  The default action	for each con-
     sistency correction is to wait for	the operator to	respond	yes or no.  If
     the operator does not have	write permission on the	filesystem fsck_lfs
     will default to a -n action.

     The following flags are interpreted by fsck_lfs:

     -b	block	 Use block as the super	block for the filesystem.

     -d		 Print debugging output.

     -f		 Force checking	of file	systems.  Normally, if a file system
		 is cleanly unmounted, the kernel will set a "clean flag" in
		 the file system superblock, and fsck_lfs will not check the
		 file system.  This option forces fsck_lfs to check the	file
		 system, regardless of the state of the	clean flag.

     -m	mode	 Use mode specified in octal as	the permission bits to use
		 when creating the lost+found directory	rather than the	de-
		 fault 1700.  In particular, systems that do not wish to have
		 lost files accessible by all users on the system should use a
		 more restrictive set of permissions such as 700.

     -n		 Assume	a no response to all questions asked by	fsck_lfs ex-
		 cept for `CONTINUE?', which is	assumed	to be affirmative; do
		 not open the filesystem for writing.

     -p		 Specify "preen" mode.	Currently, in this mode	fsck_lfs rolls
		 forward from the older	checkpoint, and	performs no other ac-

     -q		 Quiet mode, do	not output any messages	for clean filesystems.

     -U		 Resolve user ids to user names.

     -y		 Assume	a yes response to all questions	asked by fsck_lfs;
		 this should be	used with great	caution	as this	is a free li-
		 cense to continue after essentially unlimited trouble has
		 been encountered.

     Inconsistencies checked are as follows:
	   1.	Blocks claimed by more than one	inode.
	   2.	Blocks claimed by an inode outside the range of	the filesys-
	   3.	Incorrect link counts.
	   4.	Size checks:
		      Directory	size not a multiple of DIRBLKSIZ.
		      Partially	truncated file.
	   5.	Bad inode format.
	   6.	Directory checks:
		      File pointing to unallocated inode.
		      Inode number out of range.
		      Dot or dot-dot not the first two entries of a directory
		      or having	the wrong inode	number.
	   7.	Super Block checks:
		      More blocks for inodes than there	are in the filesystem.
	   8.	Index File checks:
		      "In use" inodes on free list, or free inodes not on free
		      Segment block counts incorrect, or "clean" segments con-
		      taining live data.

     Orphaned files and	directories (allocated but unreferenced) are, with the
     operator's	concurrence, reconnected by placing them in the	lost+found di-
     rectory.  The name	assigned is the	inode number.  If the lost+found di-
     rectory does not exist, it	is created.  If	there is insufficient space
     its size is increased.

     Because of	inconsistencies	between	the block device and the buffer	cache,
     the raw device should always be used.

     The diagnostics produced by fsck_lfs are fully enumerated and explained
     in	Appendix A of Fsck - The UNIX File System Check	Program.

     fstab(5), fsck(8),	newfs_lfs(8), reboot(8)

     The fsck_lfs program was first made available in NetBSD 1.4.

     Most of the fsck_lfs program was taken from fsck_ffs(8); what was not was
     written by	Konrad Schroder	<>.

BSD				October	9, 2008				   BSD


Want to link to this manual page? Use this URL:

home | help