apache/hadoop · error · NotInMountpointException
getDefaultBlockSize on path `<f>' is not within a mount poin
Error message
getDefaultBlockSize on path `<f>' is not within a mount point
What it means
ViewFileSystem.getDefaultBlockSize(Path) first resolves the path through the mount table (fsState.resolve). When resolution ends in a FileNotFoundException - the path is not covered by any configured mount link - the code translates it into NotInMountpointException("getDefaultBlockSize", f), an UnsupportedOperationException. The block size of a path is a property of the target file system, so viewfs cannot answer for unmounted paths.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java:973
@Override
public short getDefaultReplication() {
throw new NotInMountpointException("getDefaultReplication");
}
@Override
public FsServerDefaults getServerDefaults() throws IOException {
throw new NotInMountpointException("getServerDefaults");
}
@Override
public long getDefaultBlockSize(Path f) {
try {
InodeTree.ResolveResult<FileSystem> res =
fsState.resolve(getUriPath(f), true);
return res.targetFileSystem.getDefaultBlockSize(res.remainingPath);
} catch (FileNotFoundException e) {
throw new NotInMountpointException(f, "getDefaultBlockSize");
} catch (IOException e) {
throw new RuntimeException("Not able to initialize fs in "
+ " getDefaultBlockSize for path " + f + " with exception", e);
}
}
@Override
public short getDefaultReplication(Path f) {
try {
InodeTree.ResolveResult<FileSystem> res =
fsState.resolve(getUriPath(f), true);
return res.targetFileSystem.getDefaultReplication(res.remainingPath);
} catch (FileNotFoundException e) {
throw new NotInMountpointException(f, "getDefaultReplication");
} catch (IOException e) {
throw new RuntimeException("Not able to initialize fs in "
+ " getDefaultReplication for path " + f + " with exception", e);
}View on GitHub (pinned to 2add963021)
Solutions
- Add the missing mount entry, e.g. fs.viewfs.mounttable.default.link.tmp=/tmp on the target cluster in core-site.xml
- Call getDefaultBlockSize on a path that is already known to be mounted (verify with `hadoop fs -ls viewfs://cluster/`)
- Add fs.viewfs.mounttable.default.linkMergeSlash=hdfs://nameservice1/ so every path resolves to a real file system
- Catch NotInMountpointException in generic tooling and fall back to the target cluster's dfs.blocksize
Example fix
<!-- before: /tmp not mounted, getDefaultBlockSize(new Path("/tmp")) throws -->
<property>
<name>fs.viewfs.mounttable.default.link.data</name>
<value>hdfs://nameservice1/data</value>
</property>
<!-- after: add the tmp mount -->
<property>
<name>fs.viewfs.mounttable.default.link.tmp</name>
<value>hdfs://nameservice1/tmp</value>
</property> Defensive patterns
Strategy: validation
Validate before calling
// Verify the path prefix is covered by a configured mount before asking for block size
static boolean isMounted(Configuration conf, Path p) {
String path = Path.getPathWithoutSchemeAndAuthority(p).toString();
if (conf.get("fs.viewfs.mounttable.default.linkMergeSlash") != null) return true;
for (Map.Entry<String,String> e : conf) {
String k = e.getKey();
if (k.startsWith("fs.viewfs.mounttable.default.link.")
&& ("/" + path).startsWith(k.substring("fs.viewfs.mounttable.default.link.".length()))) {
return true;
}
}
return false;
} Try / catch
try {
long bs = fs.getDefaultBlockSize(p);
} catch (NotInMountpointException e) {
// p not covered by the mount table: mount it or use cluster default
long bs = conf.getLongBytes("dfs.blocksize", 128L * 1024 * 1024);
} Prevention
- Keep a checklist of every absolute path jobs use (/tmp, /user, /data) and mirror each as a link in the mount table
- Smoke-test mounts after config changes: `hadoop fs -ls viewfs://cluster/` must show every expected dir
- Never assume '/' or parent dirs resolve; only rely on configured leaf mounts
When it happens
Trigger: Calling getDefaultBlockSize(new Path("/tmp")) when no fs.viewfs.mounttable.default.link.tmp entry exists; calling it on "/" or on a mount-table-only internal directory (e.g. /data when only /data/hdfs is mounted); typos in the path that fall outside every mount prefix.
Common situations: Cluster migration to viewfs where the old absolute paths (/tmp, /user, /data) were not all added to the mount table; jobs assuming /tmp exists; mount table loaded from a config file that is not on the client classpath so the table is effectively empty.
Related errors
- ViewFs: Non absolute mount name in config:{src}
- Path {nextInode.fullPath} already exists as link
- Path {strB} already exists as dir; cannot create link here
- Unexpected mount table link entry '{key}'. Use linkMergeSlas
- ViewFs: Cannot initialize: Invalid entry in Mount table in c
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/101107b081880eeb.
Report an issue: GitHub.