Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mounting NFS Share using pathfs.LoopbackFileSystem #49

Closed
imnaveed opened this issue Jun 8, 2015 · 5 comments
Closed

Mounting NFS Share using pathfs.LoopbackFileSystem #49

imnaveed opened this issue Jun 8, 2015 · 5 comments

Comments

@imnaveed
Copy link

imnaveed commented Jun 8, 2015

Hi Dear,

I can mount local folder using "FileSystem: pathfs.NewLoopbackFileSystem("/mnt/local")" and can do listing and all other operations; but I can't mount an NFS Share (/home directory) using: "FileSystem: pathfs.NewLoopbackFileSystem("192.168.1.7:/home")".

What could I be missing here? Remember, I can mount NFS Share using normal NFS Client.

code snippet:


//nfsRoot := "192.168.1.7:/home"
nfsRoot := "/tmp/nvd"
mountPoint := "/mnt/storage/1"

os.MkdirAll(mountPoint, 0777)
cffs := fs.NewCFFileSystem(nfsRoot)

vfs := pathfs.NewPathNodeFs(cffs, nil)
vfs.SetDebug(false)
conn := nodefs.NewFileSystemConnector(vfs.Root(), nil)

mOpts := fuse.MountOptions{
AllowOther: true,
RememberInodes: true,
}

server, err := fuse.NewServer(conn.RawFS(), mountPoint, &mOpts)
if err != nil {
log.Fatalf("Mount fail: %v\n", err)
}
log.Println("start server")

server.Serve()

Looking forward to your response...

@hanwen
Copy link
Owner

hanwen commented Jun 9, 2015

what happens if you do:

ls 192.168.1.7:/home

?

@imnaveed
Copy link
Author

imnaveed commented Jun 9, 2015

$ ls 192.168.1.102:/home
ls: cannot access 192.168.1.102:/home: No such file or directory

@imnaveed
Copy link
Author

imnaveed commented Jun 9, 2015

I've exported NFS directories from Server following article below:
https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-14-04

I can mount in a standard way; like on client machine I can mount it like this:
sudo mount 192.168.1.102:/home /mnt/nfs/home
and I can do listing and all other stuff... More-over I can run go-fuse loopback on already mounted directory like:

bfs := pathfs.NewLoopbackFileSystem("/mnt/nfs/home")
and it also does work well.

But I can't mount remote NFS directory directly; I'm trying to do it like:
bfs := pathfs.NewLoopbackFileSystem("192.168.1.102:/home") - which of course is not a good way to do it.

So what can be I missing above; or is it possible to mount it directly using go-fuse; or I first have to mount in explicitly and then loopback over already mounted directory though this doesn't makes sense to me; please guide...

  • Thanks

@hanwen
Copy link
Owner

hanwen commented Jun 9, 2015

you have to mount explicitly first, or write your own NFS client in Go (which is a lot of work).

@hanwen hanwen closed this as completed Jun 9, 2015
@imnaveed
Copy link
Author

imnaveed commented Jun 9, 2015

alright,

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants