Page 1 of 1
How to mount 2 raspberry pi's to each other
Posted: Wed Apr 01, 2015 3:33 pm
by Canedje
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.
Re: How to mount 2 raspberry pi's to each other
Posted: Wed Apr 01, 2015 3:38 pm
by DougieLawson
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.
Re: How to mount 2 raspberry pi's to each other
Posted: Wed Apr 01, 2015 3:50 pm
by Canedje
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
Re: How to mount 2 raspberry pi's to each other
Posted: Wed Apr 01, 2015 3:56 pm
by DougieLawson
Re: How to mount 2 raspberry pi's to each other
Posted: Wed Apr 01, 2015 4:34 pm
by Canedje
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
Re: How to mount 2 raspberry pi's to each other
Posted: Wed Apr 01, 2015 7:23 pm
by DougieLawson
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.
Re: How to mount 2 raspberry pi's to each other
Posted: Wed Apr 01, 2015 9:05 pm
by Canedje
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?
Re: How to mount 2 raspberry pi's to each other
Posted: Wed Apr 01, 2015 10:09 pm
by DougieLawson
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.
Re: How to mount 2 raspberry pi's to each other
Posted: Fri Apr 03, 2015 6:42 pm
by Canedje
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
Re: How to mount 2 raspberry pi's to each other
Posted: Sat Apr 04, 2015 7:57 am
by Canedje
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?
Re: How to mount 2 raspberry pi's to each other
Posted: Sat Apr 04, 2015 8:07 am
by DougieLawson
You only need /etc/exports on the NFS server not on the client. On the client you use /etc/fstab to mount the share.
Re: How to mount 2 raspberry pi's to each other
Posted: Sat Apr 04, 2015 8:23 am
by rpdom
Check your filesystems are being exported correctly with sudo exportfs -v on each server.
Re: How to mount 2 raspberry pi's to each other
Posted: Mon Apr 06, 2015 10:06 am
by Canedje
I chnged nothing.
But everything is working fine now???