Create directory in hadoop filesystem

To leave safe mode, try below command since hadoop dfsadmin -safemode is deprecated in newer distribution of Hadoop:

 hdfs dfsadmin -safemode leave

By default, user's home directory in hdfs exists with '/user/hduser' not as /home/hduser'.

If you tried to create directory directly like below then it will be created like '/user/hduser/sampleDir'.

hadoop fs -mkdir /path/to/be/created

Create a directory /user

hadoop fs -mkdir /user

then with your user name

hadoop fs -mkdir /user/yourusername

Now try to creating directory.


On HDFS,

hdfs dfs -mkdir -p /this/is/a/new/directory

List your directory

hadoop fs -ls /

Output:

Found 1 items
drwxr-xr-x   - sony supergroup          0 2016-12-10 16:45 /usr

create a directory

hadoop fs -mkdir /app

created successfully and check

hadoop fs -ls /

Output:

Found 2 items
drwxr-xr-x   - sony supergroup          0 2016-12-12 04:11 /usr
drwxr-xr-x   - sony supergroup          0 2016-12-10 16:45 /app