nfs4j icon indicating copy to clipboard operation
nfs4j copied to clipboard

macOS compatiblity

Open advaleigh opened this issue 7 years ago • 1 comments

I am attempting to get a NFS server working on macOS Sierra (10.12.6). java version "1.8.0_151". The same code works fine on CentOS 7.

In the macOS case, it successfully registers (visible in rpcinfo) and the bindings look correct. The system has the firewall disabled.

showmount -e fails with "showmount: Cannot retrieve info from host: localhost: RPC failed:: RPC: Procedure unavailable"

~aleigh$ rpcinfo -u localhost nfs rpcinfo: RPC: Procedure unavailable program 100003 version 0 is not available rpcinfo: RPC: Procedure unavailable program 100003 version 4294967295 is not available

~ aleigh$ rpcinfo -u localhost mountd rpcinfo: RPC: Procedure unavailable program 100005 version 0 is not available rpcinfo: RPC: Procedure unavailable program 100005 version 4294967295 is not available

I am willing to put in the time to fix this problem, but I wonder if this is a known issue, or if there is any advice.

public class NfsServer { private static final MechaLogger logger = MechaLoggerFactory.getLogger(NfsServer.class); private final OncRpcSvc service;

public NfsServer(VirtualFileSystem vfs, ExportFile exportFile) throws IOException {
    // create the RPC service which will handle NFS requests
    service = new OncRpcSvcBuilder()
            .withPort(2049)
            .withTCP()
            .withUDP()
            .withAutoPublish()
            .withWorkerThreadIoStrategy()
            .build();

    // create NFS v4.1 server
    //   NFSServerV41 nfs4 = new NFSServerV41(new MDSOperationFactory(), null, vfs, exportFile);

    // create NFS v3 and mountd servers
    NfsServerV3 nfs3 = new NfsServerV3(exportFile, vfs);
    MountServer mountd = new MountServer(exportFile, vfs);

    // register NFS servers at portmap service
    //  service.register(new OncRpcProgram(100003, 4), nfs4);
    service.register(new OncRpcProgram(100003, 3), nfs3);
    service.register(new OncRpcProgram(100005, 3), mountd);
}

public void run() {
    try {
        service.start();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

public static void main(String args[]) throws IOException {
    NfsServer srv = new NfsServer(new SdsFs(), new ExportFile(new File("exports.nfs")));
    srv.run();
    ThreadUtil.forever();
}

}

advaleigh avatar Feb 16 '18 20:02 advaleigh

Actually I expect that your simple example must work ander osx. Let me test and come back to you. Wat do you see when you run rpcinfo localhost?

kofemann avatar Feb 19 '18 19:02 kofemann