Skip to content

Instantly share code, notes, and snippets.

@sirkkalap
Last active September 3, 2016 21:23
Show Gist options
  • Save sirkkalap/40261ed82386ad8a6409 to your computer and use it in GitHub Desktop.
Save sirkkalap/40261ed82386ad8a6409 to your computer and use it in GitHub Desktop.
A script to switch boot2docker to use NFS instead of VBoxfs for speed and proper permissions
#!/bin/bash
############################################################################
# Note: Special network 192.162.50.3 to use Cisco Anyconnect Split tunnel.
#
# On OX X host you need to add a line (and file) /etc/exports:
# /Users -mapall=[youruser]:[yourgroup] [boot2dockerip]
# See: https://quip.com/EDYLAAfuup5M (no login needed)
# See also: https://github.com/boot2docker/boot2docker/issues/587#issuecomment-66935011
# See also: http://support.apple.com/en-us/HT202243
# See also: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/exports.5.html
#############################################################################
sudo umount /Users
sudo /usr/local/etc/init.d/nfs-client start
sudo mount 192.168.50.3:/Users /Users -o rw,async,noatime,rsize=32768,wsize=32768,proto=tcp
@sirkkalap
Copy link
Author

To run this script inside boot2docker:

  1. Have your IP set up to the network I use here, or fork the script and edit
  2. run
   curl -sSL https://gist.githubusercontent.com/sirkkalap/40261ed82386ad8a6409/raw/005b70f82992e2ea19b1cb467d05032249ef5020/nfs-mount-boot2docker.sh | bash - 

(the url is the url from Raw Gist)

@sirkkalap
Copy link
Author

@willrstern
Copy link

Did you encounter/fix this error?

mount: RPC: Authentication error; why = Client credential too weak
mount: mounting 192.168.1.98:/Users on /Users failed: Bad file descriptor

@olalonde
Copy link

Getting same error.

@olalonde
Copy link

The error went away after running nfsd restart on OS X. But now, the mount command on boot2docker just hangs there and never terminates.

@olalonde
Copy link

Oh, finally got this error message:

Starting nfs client utilities.
mount: RPC: Remote system error - Connection timed out
mount: mounting 192.168.0.101:/Users on /Users failed: Bad file descriptor
error in run: exit status 110

@olalonde
Copy link

I finally got it to work with the default networking settings (NAT) and wrote a bash script (it will also setup the host machine): https://gist.github.com/olalonde/3f7512c0bd2bc8abb46d

@TOMOAKI12345
Copy link

curl -sSL https://gist.githubusercontent.com/sirkkalap/40261ed82386ad8a6409/raw/005b70f82992e2ea19b1cb467d05032249ef5020/nfs-mount-boot2docker.sh | bash -

umount: /Users: not currently mounted
sudo: /usr/local/etc/init.d/nfs-client: command not found
usage: mount [-dfruvw] [-o options] [-t external_type] special node
mount [-adfruvw] [-t external_type]
mount [-dfruvw] special | node

I can't find nfs-client command. How should I do ?

@keipes
Copy link

keipes commented Apr 14, 2015

TOMOAKI12345 are you running that command inside of the boot2docker vm?

e.g.:

developer@machine:~$ boot2docker ssh
docker@boot2docker:~$ curl -sSL https://gist.githubusercontent.com/sirkkalap/40261ed82386ad8a6409/raw/005b70f82992e2ea19b1cb467d05032249ef5020/nfs-mount-boot2docker.sh | bash -

@keipes
Copy link

keipes commented Apr 14, 2015

I resolved the: mount: RPC: Authentication error; why = Client credential too weak error by adding the following to /etc/nfs.conf:

nfs.server.mount.require_resv_port = 0

Then restarting the nfs daemon with:

nfsd restart

@haggen
Copy link

haggen commented Apr 29, 2015

After a while I got it working. Thanks for the help!

https://gist.github.com/haggen/f84f55e3ed2c9c930335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment