Hope you are doing well,
Please follow the steps given below:
Step 1 : Stop all the daemons first
stop-all.sh
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
mkdir directory_name
chmod 755 directory_name
Step 4 : Format the namenode
bin/hadoop namenode -format
Step 5 : Start all the daemons
start-all.sh
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.