When we create a directory in HDFS or move a directory from the local machine to HDFS, we occasionally encounter the following error.
Cannot create directory /location/. Name node is in safe mode.
This is because the name node went into safe mode. NameNode may enter Safemode for a variety of reasons. The most possible reason can be, the amount of space available is less than the amount of space required for the NameNode storage directory. As a result, the HDFS becomes readonly. That means we can’t add any new directories or files to the HDFS because it will interfere with file replication due to limited storage.
Inorder to create the directories, issue the following command to leave from the safe mode, after sorting out the space issue.
sudo -u hdfs hdfs dfsadmin -safemode leave
Now, you can create the directory successfully.
One comment