Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

How to mount 2 raspberry pi's to each other

Wed Apr 01, 2015 3:33 pm

I'm trying to mount two raspberry pi's to each other.
I do receive an error 13:


mount.cifs kernel mount options: ip=192.168.2.185,unc=\\192.168.2.185\home,user=ewh,,domain=workgroup,prefixpath=ewh,pass=********
mount error(13): Permission denied


What am I doing wrong?
I'm able to mount to a NAS on the same way.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to mount 2 raspberry pi's to each other

Wed Apr 01, 2015 3:38 pm

DON'T USE CIFS.

Use NFS (which is the native Linux network file system) and about 10^3 times easier to set up than CIFS. NFS uses the local security system on the shared drive.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: How to mount 2 raspberry pi's to each other

Wed Apr 01, 2015 3:50 pm

DougieLawson wrote:DON'T USE CIFS.

Use NFS (which is the native Linux network file system) and about 10^3 times easier to set up than CIFS. NFS uses the local security system on the shared drive.
Thanks. Do you have an example line to set up /etc/fstab?
I like to set up a mount from //192.168.2.185/home/ewh to /mnt/PI

I tried:
192.168.2.185:/home/ewh /mnt/PI nfs rsize=8192,wsize=8192,timeo=14,intr 0 0
The error: Connection refused
Last edited by Canedje on Wed Apr 01, 2015 4:28 pm, edited 2 times in total.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to mount 2 raspberry pi's to each other

Wed Apr 01, 2015 3:56 pm

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: How to mount 2 raspberry pi's to each other

Wed Apr 01, 2015 4:34 pm


I did read this document.
I tried several options like:
sudo mount 192.168.2.185:/home/ewh /mnt/PI
mount raspberrypi-1:/home/ewh /mnt/PI

etc
if I put in fstab
the error:
mount.nfs: timeout set for Wed Apr 1 18:35:04 2015
mount.nfs: trying text-based options 'vers=4,addr=192.168.2.185,clientaddr=192.168.2.201'
mount.nfs: mount(2): Connection refused

happens

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to mount 2 raspberry pi's to each other

Wed Apr 01, 2015 7:23 pm

You need to get the nfs server running first (for my examples I'll assume it has a fixed IP address of 192.168.1.100). The client doesn't need to have a fixed IP.

Then you update the shares so that the server is now ready to share stuff to the client.

Then on the client you run
showmount -e 192.168.1.100
to make sure you can see the server and see the shares it's offering
That's controlled by the /etc/exports file on 192.168.1.100

Then try mounting one
mount -t nfs 192.168.1.100:/sharename/sharesubdirectory/share /mnt
cd /mnt # and take a look at the files
nano /mnt/tester.txt # create a text file that we can look at on 192.168.1.100 later

Then when that works make a mount point on the local system and add an fstab entry
mkdir /shared
echo "192.168.1.100:/sharename/sharesubdirectory/shared /shared nfs defaults 0 0" >> /etc/fstab
The fstab means things will get mounted at boot time

reboot to test that.

Logon to 192.168.1.100 and look at /shares/sharesubdirectory/shared/tester.txt to convince yourself it's working.

Grab a beer and celebrate a job well done.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: How to mount 2 raspberry pi's to each other

Wed Apr 01, 2015 9:05 pm

Thanks
I succeded for a big part now.
I made a shared mnt onm both raspberry's. I can see the shared files and open them
I'm not allowed to write on the shared directory. What do I need to change, where to be able to write on both shared directories?

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to mount 2 raspberry pi's to each other

Wed Apr 01, 2015 10:09 pm

You need to ensure that your users (/etc/passwd) and groups (/etc/group) are identical on both machines. Or add a new group and a new userid with the same UID=nnnn and GID=nnnn value on both machines.

Also ensure that the share is shared as RW and mounted as RW.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: How to mount 2 raspberry pi's to each other

Fri Apr 03, 2015 6:42 pm

DougieLawson wrote:You need to ensure that your users (/etc/passwd) and groups (/etc/group) are identical on both machines. Or add a new group and a new userid with the same UID=nnnn and GID=nnnn value on both machines.

Also ensure that the share is shared as RW and mounted as RW.
I do have both enabled as RW the share and the mounted

How do I get the users and groups indentical on both machines?
I do have a Pi log in, and a personal login on both machines

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: How to mount 2 raspberry pi's to each other

Sat Apr 04, 2015 7:57 am

I thought it was solved, but I still having some problems.
After a separate reboot one of the raspberry's won't mount.
As far as I can mention are both configured the same:
in exports of raspberry1:

Code: Select all

ewh@raspberrypi-1 ~ $ cat /etc/exports
/home/ewh 192.168.2.201(rw) 192.168.2.186(rw)
In exports of raspberry2:

Code: Select all

ewh@raspberrypi-2 ~ $ cat /etc/exports
/home/ewh 192.168.2.185(rw) 192.168.2.200(rw)
In fstab raspberyy1

Code: Select all

ewh@raspberrypi-1 ~ $ cat /etc/fstab
192.168.2.201:/home/ewh /mnt/PI nfs rw 0 0
In fstab raspberry2:

Code: Select all

ewh@raspberrypi-2 ~ $ cat /etc/fstab
192.168.2.185:/home/ewh /mnt/PI nfs rw 0 0
After restart raspberry2 it is not mounted.
By trying: sudo mount -av an error occurs connection refused:

Code: Select all

ewh@raspberrypi-2 ~ $ sudo mount -av
mount: proc already mounted on /proc
mount: /dev/mmcblk0p5 already mounted on /boot
mount: //192.168.2.100/NetwerkSchijf/Edward/BackupRasp already mounted on /mnt/NAS
mount.nfs: timeout set for Sat Apr  4 09:56:09 2015
mount.nfs: trying text-based options 'vers=4,addr=192.168.2.185,clientaddr=192.168.2.201'
mount.nfs: mount(2): Connection refused

By typing showmount next happened:

Code: Select all

ewh@raspberrypi-2 ~ $ showmount -e 192.168.2.185
clnt_create: RPC: Program not registered
Only after manualy restarting nfs server the mount will succeed:

Code: Select all

sudo service nfs-kernel-server restart
What can cause this problem?
Last edited by Canedje on Sat Apr 04, 2015 8:13 am, edited 1 time in total.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to mount 2 raspberry pi's to each other

Sat Apr 04, 2015 8:07 am

You only need /etc/exports on the NFS server not on the client. On the client you use /etc/fstab to mount the share.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: How to mount 2 raspberry pi's to each other

Sat Apr 04, 2015 8:23 am

Check your filesystems are being exported correctly with sudo exportfs -v on each server.

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: How to mount 2 raspberry pi's to each other

Mon Apr 06, 2015 10:06 am

I chnged nothing.
But everything is working fine now???

Return to “Troubleshooting”