Hope you are doing well,
Please follow the steps given below:
Step 1 : Stop all the daemons first
Step 2 : Delete the datanode directories which you have mentioned in the hdfs-site.xml
rm -rf datanode_directory
Step 3 : Re-create the datanode directories again and
chmod 755 directory_name
Step 4 : Format the namenode
bin/hadoop namenode -format
Step 5 : Start all the daemons
I think this will resolve your query.
Please let me know if you have any further issue regarding this.
Feel free to contact us in case you have any query.
Kindly share your feedback by clicking on either of the smiley's.