kofemann/vfs4j

/directory/to/export can only use "/"

Closed this issue · 2 comments

I have tested this code and noticed that "/directory/to/export" can not use the same directory that I used in /etc/exports file.

Here is what I have in my /etc/exports file:
/var/lib/testvfs4j/nfs *(rw,sec=NONE)

And when I run the jar file, I tried:
java -jar vfs4j-1.0-SNAPSHOT.jar /var/lib/testvfs4j/nfs /etc/exports

And when I run:
mount -t nfs localhost:/var/lib/testvsf4j/nfs /tmp/mnt

it returns error as:
mount.nfs: mounting localhost:/var/lib/testvfs4j/nfs failed, reason given by server: No such file or directory

2019-03-19 14:22:59.147 [localhost/0:0:0:0:0:0:0:1:999] [OncRpcSvc (15)] WARN o.d.n.v.PseudoFs - No exports found for: localhost/0:0:0:0:0:0:0:1
2019-03-19 14:22:59.200 [localhost/127.0.0.1:928] [OncRpcSvc (1)] WARN o.d.n.v.PseudoFs - No exports found for: localhost/127.0.0.1
2019-03-19 14:22:59.238 [localhost/0:0:0:0:0:0:0:1:933] [OncRpcSvc (0)] WARN o.d.n.v.PseudoFs - No exports found for: localhost/0:0:0:0:0:0:0:1
2019-03-19 14:22:59.265 [localhost/127.0.0.1:701] [OncRpcSvc (13)] WARN o.d.n.v.PseudoFs - No exports found for: localhost/127.0.0.1
2019-03-19 14:22:59.301 [] [OncRpcSvc (1)] WARN o.d.n.v.MountServer - mount request failed:

I also tried use /var/lib/testvfs4j or /var/lib... none of them are working and return error as:
mount.nfs: access denied by server while mounting localhost:/var/lib/testvfs4j

The only format works is when I use "/" so that the starting command becomes:

java -jar vfs4j-1.0-SNAPSHOT.jar / /etc/exports

Could you please give me some idea if this is a bug in the code or as designed?

Thanks,

I would say it works as expected. The idea is that you define your filesystem root and export file paths are relative to it. IOW, if you have directory /store/data/vol1 and want to export it, then there are multiple possibilities:

fs root export path
/ /store/data/vol1
/store /data/vol1
/store/data /vol1
/store/data/vol1 /

Does it makes sense to you?

Yes, it solved my issue. Thanks a lot