Closed grahampugh closed 3 years ago
@grahampugh Thank you for the feedback.
I have been thinking of the same thing, too.
I agree with your idea, --nfs
parameter for xhyverun.sh
.
But it is not so easy to specify the mount point, because the mount script in the VM (NFS client side) has to know the mount point as well as the vmnet_export.sh
(NFS server side).
To pass the mount point to the VM, I have two options so far.
What do you think?
Solution no.2 may be late for some containers which have volumes under the NFS mount. I would choose no.1.
Hi, I've found that NFS mounting isn't working on external volumes (i.e. a folder in /Volumes). It might be due to the external volume having ownership disabled (as is normal for external USB disks). I haven't experimented with setting the USB disk to have ownership enabled, to see if that solves the problem. (I'm also not sure why this isn't a problem with a Vagrant Ubuntu/Centos VM, but is with boot2docker and Docker-Machine).
@grahampugh Hi, thank you for the information. I guess we need to modify some mount options in the startup script in the VM. Or something in the /etc/exports. https://github.com/ailispaw/boot2docker-xhyve/blob/master/config/bootsync.sh
Hi. Yeah perhaps. I'm afraid I don't really understand how vmnet_export.sh
and config/bootsync.sh
interact. I tried appending the following to bootsync.sh
but it didn't do anything (even if I changed the line in vmnet_export.sh
to reflect this share - and I tried it with folders on the system volume such as /Applications):
# Custom folder
source_volume="/Volumes/Images" # comment this out if you don't want an additional NFS mount
vm_mount="/Images"
if [ -z ${source_volume} ]; then
mkdir -p ${vm_mount}
umount ${vm_mount}
if [ -n "${GW_IP}" ]; then
mount_nfs -o "vers=3,noowners,nolocks,nolockd,nolock,nonlm,automounted,nosuid,hard,bg,noresvport,intr,rw,tcp,nfc" ${GW_IP}:${source_volume} ${vm_mount}
fi
fi
I'm at AWS re:Invent. I will figure it out this weekend.
Your /etc/exports in the host and /var/lib/boot2docker/bootsync.sh in the VM should be the followings.
/etc/exports
"/Volumes/Images" -network 192.168.64.0 -mask 255.255.255.0 -alldirs -mapall=501:20
/var/lib/boot2docker/bootsync.sh
#!/bin/sh
mkdir -p /Users
umount /Users
/usr/local/etc/init.d/nfs-client start
GW_IP=$(ip route get 8.8.8.8 | awk 'NR==1 {print $3}')
if [ -n "${GW_IP}" ]; then
mount ${GW_IP}:/Users /Users -o rw,async,noatime,rsize=32768,wsize=32768,proto=tcp
fi
# Custom folder
source_volume="/Volumes/Images" # comment this out if you don't want an additional NFS mount
vm_mount="/Images"
if [ -n "${source_volume}" ]; then
mkdir -p ${vm_mount}
umount ${vm_mount}
if [ -n "${GW_IP}" ]; then
mount ${GW_IP}:${source_volume} ${vm_mount} -o rw,async,noatime,rsize=32768,wsize=32768,proto=tcp
fi
fi
I will keep the same UX as the original boot2docker which uses /Users
.
I implemented this functionality at https://github.com/ailispaw/docker-root-xhyve instead.
You can use sudo ./xhyverun.sh /Volumes/Images
there.
How do I mount something other than /Users? A command line flag would be good. For example, I use an external disk for all my virtualisation dev work, since my internal disk is too small, so I would like to nfs-mount
/Volumes/my-external-disk/somefolder
.Currently, the only way to do this seems to be to edit the last line of
vmnet_export.sh
. And any path with an extra slash in it (e.g./Users/fred/somefolder
) failsmake export-clean
.Something like
sudo ./xhyverun.sh --nfs=/Volumes/my-external-disk/somefolder
would be awesome.