org.apache.hadoop.dfs
Class DFSck

java.lang.Object
  extended by org.apache.hadoop.util.ToolBase
      extended by org.apache.hadoop.dfs.DFSck
All Implemented Interfaces:
Configurable, Tool

public class DFSck
extends ToolBase

This class provides rudimentary checking of DFS volumes for errors and sub-optimal conditions.

The tool scans all files and directories, starting from an indicated root path. The following abnormal conditions are detected and handled:

Additionally, the tool collects a detailed overall DFS statistics, and optionally can print detailed statistics on block locations and replication factors of each file.

Author:
Andrzej Bialecki

Nested Class Summary
static class DFSck.Result
          Result of checking, plus overall DFS statistics.
 
Field Summary
static int FIXING_DELETE
          Delete corrupted files.
static int FIXING_MOVE
          Move corrupted files to /lost+found .
static int FIXING_NONE
          Don't attempt any fixing .
 
Fields inherited from class org.apache.hadoop.util.ToolBase
conf
 
Constructor Summary
DFSck(Configuration conf, int fixing, boolean showFiles, boolean showBlocks, boolean showLocations)
          Filesystem checker.
 
Method Summary
 DFSck.Result fsck(String path)
          Check files on DFS, starting from the indicated path.
 void init(int fixing, boolean showFiles, boolean showBlocks, boolean showLocations)
           
static void main(String[] args)
           
 int run(String[] args)
          execute the command with the given arguments
 
Methods inherited from class org.apache.hadoop.util.ToolBase
doMain, executeCommand, getConf, setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIXING_NONE

public static final int FIXING_NONE
Don't attempt any fixing .

See Also:
Constant Field Values

FIXING_MOVE

public static final int FIXING_MOVE
Move corrupted files to /lost+found .

See Also:
Constant Field Values

FIXING_DELETE

public static final int FIXING_DELETE
Delete corrupted files.

See Also:
Constant Field Values
Constructor Detail

DFSck

public DFSck(Configuration conf,
             int fixing,
             boolean showFiles,
             boolean showBlocks,
             boolean showLocations)
      throws Exception
Filesystem checker.

Parameters:
conf - current Configuration
fixing - one of pre-defined values
showFiles - show each file being checked
showBlocks - for each file checked show its block information
showLocations - for each block in each file show block locations
Throws:
Exception
Method Detail

init

public void init(int fixing,
                 boolean showFiles,
                 boolean showBlocks,
                 boolean showLocations)
          throws IOException
Throws:
IOException

fsck

public DFSck.Result fsck(String path)
                  throws Exception
Check files on DFS, starting from the indicated path.

Parameters:
path - starting point
Returns:
result of checking
Throws:
Exception

run

public int run(String[] args)
        throws Exception
Description copied from interface: Tool
execute the command with the given arguments

Parameters:
args -
Returns:
exit code
Throws:
Exception

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2006 The Apache Software Foundation