Skip to main content
Niranjan Rao
Silver ⭐️⭐️
Dec 28, 2016 1:14 AM UTC

How to read fsimage

  • Oct 5, 2026 8:51 AM UTC
  • 3 replies
  • 19998 views
  • Translate All

How to read fsimage:

We can use Offline Image Viewer tool to view the fsimage data in a human readable format. Sometimes, this becomes more essential to analyse the fsimage to understand the usage pattern, how many 0 bite files are created, what is the space consumption pattern and is the fsimage corrupt.

Donwload the fsimage: hdfs dfsadmin –fetchImage /fsimage

This will download the latest fsimage from Name node

16/12/27 05:40:43 INFO namenode.TransferFsImage: Opening connection to 10828-1.png

We can also get the output in JSON format by using curl: curl -i http://127.0.0.1:5978/webhdfs/v1/?op=liststatus

10829-2.png

To get the output in to an output directory: hdfs ovi –p Delimited –i /fsimage/fsimage__0000000000000005792 –o /fsimage/fsimage.txt

10830-3.png

We can read the data in fsimage.txt by running: head fsimage.txt from the local folder.

10841-4.png

3 replies

dsht6955
Silver ⭐️
Dec 7, 2018 5:47 AM UTC

I'm getting OOM.

I have tried:

export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Xmx20G "; hdfs oiv ..
export HADOOP_OPTS="$HADOOP_OPTS -Xmx20G "; hdfs oiv ...
export JAVA_HEAP_MAX="-Xmx10G"; hdfs oiv ...

None worked.

Can anybody show how to do it?

Thx

Translate
kingpin
Gold ⭐️
Gold ⭐️
Feb 6, 2020 10:21 AM UTC

Hi @dsht6955 ,

Can you try running the hdfs oiv command with -t flag as show below and see if that helps:

 

hdfs oiv -p Delimited -delimiter delimiterString -t temporaryDir -i fsimage -o output.xml

 

Thanks

Vipin

Translate
sipocootap2
Silver ⭐️⭐️⭐️
May 31, 2021 8:30 AM UTC

What if there are multiple namespaces with multiple namenodes? `hdfs dfsadmin -fetchImage` command only reads from the default namespace.

Translate