First find the Hadoop directory present in /usr/lib. There you can find the etc/hadoop directory, where all the configuration files are present.
In that directory you can find the hdfs-site.xml file which contains all the details about HDFS. There you find 2 properties:
dfs.namenode.name.dir – tells where the namenode stores the metadata on the local filesystem.
dfs.datanode.data.dir – tells where the datanode stores the data on the local filesystem