Usually fsimage files, which contain file system namespace on namenodes are not human-readable. So, Hadoop provided HDFS Offline Image viewer in hadoop-2.0.4 release to view the fsimage contents in readable format.
This is completely offline in its functionality and doesn’t require HDFS cluster to be running. It can easily process very large fsimage files quickly and present in required output format.
HDFS Offline Image Viewer:
Syntax for this command:
Here Options are processing options which decide the output format and these are not mandatory. Default processing option is lsr -style output format.
It supports other output processing formats as well, as listed in below screen.
Other two important processing options are Indented ( Uses levels of indentation to delineate the sections within the file) and XML format (Creates an XML document with all elements of the fsimage enumerated).
By default oiv tool overwrites the output files If they already exist.
1. Actual HDFS file system directory structure listed by fs -lsr command.
2. Using oiv tool to view fsimage file in -lsr format. Input file directory is mentioned in -i option and output directory location is mentioned in -o option.
The output file fsimage.txt is created in $HOME directory looks like below.
Thus the output of oiv tool is similar to lsr -style output.
The output file can be created in .xml format also so that it will be suitable for further analysis by XML tools.
Syntax for Usage of XML processing option:
Example usage and output file screen shots are provided below.
Output format looks like below.
This indented format is used to delineate the section of input fsimage file into separate levels of indentation. Usually this will created in .txt file extension.
Syntax for indented format is
Example usage of indented option is shown below.
The output of indented format looks like as shown below
One of the another important option is -skipBlocks which skips inode’s blocks information and significantly decreases output and increases speed in case of large image files.