You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -97,56 +97,50 @@ After creating the file, the `nfsd` daemon [should automatically start up][OSXSe
97
97
98
98
If you make changes to `/etc/exports`, activate them with `nfsd update`.
99
99
100
-
Now update the fstab on the EV3.
101
-
102
100
## How To Do It - EV3
103
101
104
-
On the EV3 we first need to enable and start NFS modules. Type these commands on the command line:
105
-
106
-
sudo systemctl enable nfs-common.service
107
-
sudo systemctl start nfs-common.service
108
-
sudo systemctl enable rpcbind.service
109
-
sudo systemctl start rpcbind.service
110
-
111
-
Next you'll need to update a file (as root) called `/etc/fstab`. You should have already set up USB Networking, so `ssh` to the EV3 and run an editor like `vi` or `nano` to edit the file. Here's the line you want to add to `/etc/fstab` - DO NOT TOUCH ANYTHING ELSE IN THERE!
102
+
On the client - ev3dev - side, we need to create, test and enable a systemd `mount.unit` file in order to mount our newly created NFS share.
112
103
104
+
{% include /style/icon.html type="warning" %}
105
+
The classic way of mounting the NFS share via an entry in `/etc/fstab` does not work! It can cause ev3dev to hang during boot up.
106
+
{: .alert .alert-warning}
113
107
114
-
# NOTE - the following examples all use the same IP address for the host, in practice, there would
115
-
# be separate addresses for each host!
108
+
First off, we need to create our `mount.unit` file. This file needs to be named after the directory where we want to mount our NSF share, with the slashes replaced by hyphens. For this tutorial, we will mount the NFS share at `/home/robot/nfsshare/` - feel free to change this to suit your needs.
Create and open the file `/etc/systemd/system/home-robot-nfsshare.mount`. Add the following sections:
125
111
112
+
[Unit]
113
+
Description=Mount an nfs share
114
+
After=network.target
115
+
116
+
[Mount]
117
+
What=192.168.0.10:/path/to/shared/folder
118
+
Where=/home/robot/nfsshare
119
+
Type=nfs
120
+
121
+
[Install]
122
+
WantedBy=multi-user.target
123
+
124
+
The `[Unit]` section provides a general description of the systemd unit file we have just created. The `After=network.target` line tells systemd to only attempt to mount this after a network connection has been established.
126
125
127
-
It's not too hard to figure out what's going on here. The host machine with the nfs mount is at `192.168.2.1` and we added `/home/hostuserid/nfs/ev3dev` (or whatever the host is exporting the directory as) to the `/etc/exports` file on that machine. The next section of the line says we want to mount it locally at `/home/ev3userid/nfs/linux`, or whatever directory you choose.
126
+
The `[Mount]` section describes what to mount where. For the `What=` line, replace `192.168.0.10` with the IP addres of the computer on which you configured your NFS share and `/path/to/shared/folder` with the folder you have configured to be shared. As stated above, `/home/robot/nfsshare` is the path where we want to mount the NFS share.
128
127
129
-
The options tell `mount`that:
128
+
The `[Install]` section describes, when to start this unit after it has been enabled. `WantedBy=multi-user.target` means that this file will be executed after the system is ready for a user to log in.
130
129
131
-
- this is an nfs share
132
-
- we do not want to automatically mount it at boot time (in case the host is not connected)
133
-
- general users are allowed to mount the share
134
-
- we want read/write access
135
-
- we are using nfs V3 on the host
130
+
In order to mount the NFS share, you first need to reload the systemd daemon:
136
131
137
-
Once you've updated the `/etc/fstab` file, you will need to create the mount points. Since I test `ev3dev` o n all three major platforms, I have separate directories for each nfs host. You probably only need to create one of these, but this script creates all three for me:
132
+
sudo systemctl daemon-reload
133
+
134
+
Then, we need to start the mount unit we have just created:
138
135
139
-
mkdir -p ~/nfs/linux
140
-
mkdir -p ~/nfs/windows
141
-
mkdir -p ~/nfs/osx
136
+
sudo systemctl start home-robot-nfsshare.mount
137
+
138
+
To verify that everything worked, look into the `/home/robot/nfsshare` directory and check that the files from your NFS share are there. **Note**: The directory `/home/robot/nfsshare` should have been created automatically.
142
139
143
-
Then all you need to do is mount the share, like this:
140
+
If you want your NFS share to be mounted at boot, you need to enable the mount unit by typing:
144
141
145
-
mount ~/nfs/linux
146
-
147
-
...or whichever of the above three directories you want to mount.
142
+
sudo systemctl enable home-robot-nfsshare.mount
148
143
149
-
And then you should be able to see the files on your host computer when you do `ls /home/ev3userid/nfs/ev3dev`!
150
144
151
145
## References
152
146
@@ -165,3 +159,5 @@ And then you should be able to see the files on your host computer when you do `
0 commit comments