Kitz Forum

Computer Software => Linux => Topic started by: sheddyian on June 14, 2014, 06:46:24 PM

Title: accessing disks across a network
Post by: sheddyian on June 14, 2014, 06:46:24 PM
I've now got 3 Raspberry Pis, all running Raspbian (Debian Wheezy variant).  One of them (the NAS disk server) has SAMBA server installed, the other two don't, and only one of them (the one that runs RaspXMBC media centre) has a Samba client.

This makes it awkward if I want to copy a file from one machine to another.

So, short question : what's the bext way to achieve this?

In Windows, if I want to do an ad-hoc copy of a file from one PC to another, I can reference the remote machine thus :

\\shed_pc\share_name\folder\file.ext , so I can copy to or from the remote computer without having to fiddle about mounting the remote drive or folder locally.

Would NFS do something similar?  Can I copy from a remote pi without having to mount that drive on my local pi?  Does it make all remote NFS server computers appear under a particular directory on the local pi?  Or do I misunderstand how NFS works?

Thanks,
Ian


Title: Re: accessing disks across a network
Post by: roseway on June 14, 2014, 07:26:06 PM
If you want to access machine A from machine B, then machine A must be running a networking server of some kind (Samba, NFS, SSH...), and a shared directory needs to be specified. On machine B you would then need a mount point to mount the shared directory on machine A. To make it easy to use adhoc mounts, you could set up the mount conditions in /etc/fstab with the noauto parameter, then just type "mount <mountpoint> when you want to access machine A.

Sorry that it's a bit complicated, but Linux doesn't by default enable remote connections, for good security reasons.
Title: Re: accessing disks across a network
Post by: neilius on June 14, 2014, 09:57:39 PM
Any *nix machine running an SSH server can have files pushed and pulled to and from it with the use of scp and sftp. You could also use the Windows client WinSCP to browse, upload and download files on an SSH server. Distros like Ubuntu support it natively in their file browsers, just in the same way as Samba etc. I'd guess that the encryption overhead would make it slower than Samba on a Pi but it's pretty secure and would work 'out of the box' by just enabling SSH in Raspian.
Title: Re: accessing disks across a network
Post by: sheddyian on June 18, 2014, 11:43:22 AM
As I've got samba server running on 2 out of the 3 Pis, for the time being I've mounted the remote disk using samba, by putting this in the relevant Pi's fstab :

//192.168.1.124/vol1    /mnt/pi1      cifs    username=*****,password=***** 0 0

Which does what I want to do, but thanks for your responses.  I didn't know that SSH can do things with files as well - I use it for terminal access at the moment.  I will look into using that, might be useful.

Ian



Title: Re: accessing disks across a network
Post by: burakkucat on June 18, 2014, 05:35:40 PM
I would recommend that you examine the usage of scp to copy between systems. (It makes use of ssh at a lower level.)
Title: Re: accessing disks across a network
Post by: sevenlayermuddle on June 18, 2014, 06:00:15 PM
As a belated contribution to the original questions in this thread, you may also want to look into autofs, as an alternative to putting the mounts in fstab.

It is a litte harder to set up than the fstab method, but confers two advantages...

1) There is no requirement that the remote (samba server) system be available when the client is booted, or that it remain available for the lifetime of the client, as the shares are only mounted 'on demand whenever the 'mount point' is accessed.

2) You can have a timeout after which the shares are unmounted, if no longer needed.   This is especially useful if the remote mount stops a server from sleeping/hibernating when idle, as is the case with some Windows systems I believe.

I can't promise that autofs will be present in distributions aimed at Pi, but I'd be very surprised if it were not.
Title: Re: accessing disks across a network
Post by: Alex Atkin UK on September 25, 2014, 05:19:50 AM
I realise I am extremely late to the party but I just wanted to point out that if speed/efficiency is a concern, NFS is the only real option in my experience.

SFTP/SCP/SSH is not optimised for file transfer, you will be lucky to get anything close to decent speeds.

Samba is also inefficient but generally much better.

NFS however should hit the maximum the server is capable of, but you have to watch out to unmount from the client before shutting down the server or it can effectively hang the client.  As mentioned though, autofs may help there but I have never tried that myself.