juicedata/juicefs · error

unable to dial MOUNT service %s: %v

Error message

unable to dial MOUNT service %s: %v

What it means

After parsing the address, newNFSStore dials the NFS MOUNT service (rpcbind/portmapper on the host, 3s timeout). If the dial fails — no route, portmapper not running, firewall, wrong host — the wrapped error is returned.

Source

Thrown at pkg/object/nfs.go:474

}

func newNFSStore(addr, username, pass, token string) (ObjectStorage, error) {
	if username == "" {
		u, err := user.Current()
		if err != nil {
			return nil, fmt.Errorf("current user: %s", err)
		}
		username = u.Username
	}
	b := strings.Split(addr, ":")
	if len(b) != 2 {
		return nil, fmt.Errorf("invalid NFS address %s", addr)
	}
	host := b[0]
	path := b[1]
	mount, err := nfs.DialMount(host, time.Second*3)
	if err != nil {
		return nil, fmt.Errorf("unable to dial MOUNT service %s: %v", addr, err)
	}
	auth := rpc.NewAuthUnix(username, uint32(utils.GetCurrentUID()), uint32(utils.GetCurrentGID()))
	target, err := mount.Mount(path, auth.Auth())
	target.Config.DirCount = 1 << 17
	// Readdir returns up to 1M at a time, even if MaxCount is set larger
	target.Config.MaxCount = 1 << 20
	if err != nil {
		return nil, fmt.Errorf("unable to mount %s: %v", addr, err)
	}
	umask := utils.GetUmask()
	return &nfsStore{
		username: username,
		host:     host,
		root:     path,
		fmode:    os.FileMode(0666 &^ umask),
		dmode:    os.FileMode(0777 &^ umask),
		target:   target}, nil
}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Verify connectivity: 'rpcinfo -p <host>' and 'showmount -e <host>' from the client; open ports 111 and the NFS ports in the firewall.
  2. Start rpcbind/mountd on the server (systemctl enable --now rpcbind nfs-server).
  3. Check the hostname/IP for typos and DNS resolution; confirm reachability (ping, 'telnet host 111').

Example fix

// before
newNFSStore("wrong-host:/export", "user", "", "")
// after
// verify first: rpcinfo -p nfsserver && showmount -e nfsserver
newNFSStore("nfsserver:/export", "user", "", "")
Defensive patterns

Strategy: retry

Validate before calling

conn, err := net.DialTimeout("tcp", net.JoinHostPort(host, "111"), 3*time.Second)
if err != nil {
	return fmt.Errorf("rpcbind unreachable on %s: %w", host, err)
}
conn.Close()

Try / catch

store, err := newNFSStore(addr, user, pass, "")
if err != nil && strings.Contains(err.Error(), "unable to dial MOUNT") {
	// back off and retry; server or network may be temporarily down
	time.Sleep(2 * time.Second)
	store, err = newNFSStore(addr, user, pass, "")
}

Prevention

When it happens

Trigger: newNFSStore targeting a host where rpcbind (port 111) or mountd is unreachable: server down, NFS service not started, firewall dropping TCP/UDP 111 or 2049, or DNS failure resolving the hostname.

Common situations: Connecting to an NFS server from a network that blocks port 111; rpcbind disabled on the server; typo'd hostname; containers/Kubernetes without egress to the NFS host.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/9c96cb189428633c. Report an issue: GitHub.