public static void checkDfsSafeMode(final Configuration conf) throws IOException {
    boolean isInSafeMode = false;
    FileSystem fs = FileSystem.get(conf);
    if (supportSafeMode(fs)) {
      isInSafeMode = isInSafeMode(fs);
    }
    if (isInSafeMode) {
      throw new IOException("File system is in safemode, it can't be written now");
    }
  }
Check whether dfs is in safemode.
hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java