2
votes

I understand that hdfs stores its files as blocks on datanodes, and each block is actually stored as a file in the local filesystem of each datanode.

So I would like to know if there is a way to get the actual filename in the local filesystem for an hdfs block, given that hdfs filename.

thanks.

1

1 Answers

3
votes

You can use Hadoop's FSCK command on the file you have in mind. This will return the hosts and block names. It however does not provide the full path to the file on the local filesystem.

$ hadoop fsck /path/to/file -files -blocks -locations

Another option would be through the HDFS WebUI. If you browse to each file it will list the block names and hosts.