Check the health of a file
hdfs fsck /user/root/sample.txt
... The filesystem under path '/user/root/sample.txt' is HEALTHY
Check the health of a file, and display the blocks as well
hdfs fsck /user/root/sample.txt -files -blocks
... /user/root/sample.txt 2633979 bytes, 1 block(s): OK 0. BP-1693696885-172.17.0.2-1441734712805:blk_1073742259_1435 len=2633979 repl=3 ...
Check the health of a file, display the blocks, and which nodes the file is on
hdfs fsck /user/root/sample.txt -files -blocks -locations
... 0. BP-1693696885-172.17.0.2-1441734712805:blk_1073742259_1435 len=2633979 repl=3 [172.17.0.2:50010, 172.17.0.3:50010, 172.17.0.4:50010] ...
Check the health of the entire filesystem
This must be run as user hdfs
since root
does not have full permissions.
hdfs fsck /
... The filesystem under path '/' is HEALTHY