.TH SFCK 1csound CARL 
.SH NAME
sfck 
- check sound file system for soundness
.SH SYNOPSIS
.B sfck 
[flags]
.RS .5i
.nf
* f = check connectivity between disk free list and .sdf files
* z = zap the free list (you must be a member of the disk group)
  n = check and print out cylinder usage statistics
* F = check connectivity between sound file directory and .sdf files
* A = do all the above at once, to fix a broken file system.
  p = pretty-print the disk free list file
  y = answer yes to all questions
* B = boot flag.
.RE
.fi
Flags preceeded by '*' can only be issued by a member of the 
.I disk 
group.
.PP
.SH DESCRIPTION
.B sfck 
is a continuity checker for the sound file system.  
It can be used to diagnose and fix
various illnesses in the sound file system, depending on the flags
chosen.  
.PP
Because of the responsibilities of this program, only members of the
.I csound
super-user's group can execute certain functions with 
.B sfck.
In all cases,
.B sfck
will inform you if you are not qualified for a particular operation.
.PP
.B sfck
does not masterlock the filesystem it is fixing.  This is the responsibility
of the user.  If running
.B sfck
on a routine basis uncoveres anything more serious than zapping the
free list, you should quit
.B sfck,
run 
.B locksf
on the appropriate filesystem, monitor activity until all files are
closed (use ps(1)), then re-run
.B sfck.
.SH The Flags and Functions
.IP -n
The command:
sfck -n
is a non-privledged function which
prints out the state of the free list, including the following:
.I maxcyl total used unused alloced freed biggest
where 
.I maxcyl 
is the maximum initialized size of the file system, 
.I total
is the sum of all blocks in the actual list, 
.I used 
and 
.I unused 
show how
many are currently occupied.
.I Alloced 
and 
.I freed 
refer to cylinders allocated to or freed by
(possibly) in-progress processes.  
.I Biggest 
refers to the biggest unused
contiguous block of cylinders.  This is the largest realtime file that
can be written at that moment.
.IP -f
The 
.I f 
flag reads all sdf files in all subdirectories of the filesystem under
scrutiny, and checks their cylinder lists for overlaps with other
sdf files.  It rebuilds the free list from the result.
.IP -z
The 
.I z 
flag condenses adjacent unused blocks into one block.  
.IP -A
The 
.I A 
flag does a sequence designed to manually
fix a broken sound file system.
It does the flag sequence of "fzn" automatically, in that order.
The strategy is to first scrub the free list with f and z, check to
see that these actions haven't done any harm with n. If the
free list is scrambled or blocks are missing, duplicated, or otherwise
in bad shape, 
.B sfck
goes through and arbitrates conflicts between files for who owns cylinder
blocks (or parts of blocks).  It votes in favor of whichever file was
most recently occupying a block, and requests your permission to delete
files that are adversely affected by this decision.  It collects a list
of all lost files that result from this process in /<filesystem>/loosers.
A message should be posted on the system telling these users that
they have lost files.
.IP -B
The
.I B
flag is equivalent to the flag sequence fzy in its function.  
It is designed to be run at boot time.
.SH AUTHOR
Gareth Loy
.SH SEE ALSO
lsf(1csound), rmsf(1csound), mvsf(1csound), visf(1csound).
.SH BUGS
Sometimes blocks can end up being 
listed as allocated or used on the free list but there
is no .sdf file to claim them.  This can happen if, for instance,
an .sdf file gets zeroed or deleted erroniously through some
system error.  
.B sfck
does not reclaim these orphaned blocks when it sees them so as to
not clobber the affected cylinder block.  This allows a file
to be rebuilt by hand in the rare circumstance that that is desirable.
If you want to flush such erroniously allocated blocks to retrieve
their space, rename /<fs>/dskcyls to some other name and run
.B sfck,
on that <fs> again.
.B sfck
will rebuild dskcyls from existing .sdf files, effectively
clearing the erroniously ``used'' blocks.
