Best way to mount remote folder

  • I have two RasberryPi running debian wheezy and I would like to mount a folder from computer A on computer B.

    What is the best (as in most efficient) way to do this?

    I can do it via SMB, but that is for windows, I think there must be a better way to share across linux.

  • ssice

    ssice Correct answer

    8 years ago

    You can use plenty of things, among which, popular options are:

    • NFS
    • Samba / CIFS
    • SSHFS

    By ease-of-setup I think they would have to be put in this order (top: easiest)


    Through FUSE, you can mount remote filesystems via ssh. I won't cover how, as Cristopher has already very well explained that. Just note that, in order to mount the file automatically it will need a bit more of work.


    It will allow you to use Windows and Unix machines to access the remote folder. If it's not a big deal for you, then you won't probably benefit from it. However, it's easy to automount it on init (just input the apropriate values at /etc/fstab, including username=<your-samba-username>,password=<your-samba-password> in the options column.


    It will let you authenticate just via IP (no usernames thing = faster, only of use inside your non-hostile LAN) or via Kerberos Tickets (too painful for just two Raspberries; but useful in corporate environments).

    As it has kernel mode support, it will run faster than sshfs. Besides, as there's no encryption performed it will have a better throughput, and in the case of the tiny Raspberry ARM, it may make a difference.

    Besides, it's not so painful to setup simply you trust your network. You have automount support in /etc/fstab too, and you don't have to put sensitive data (such as usernames or passwords), and if you have your usernames syncrhronized (same /etc/passwd and /etc/group files) you can use the usual POSIX permissions toolset (chown, chgrp and chmod).

    I use my Pi as an NFS server with a disks with mostly my movies and other media (ie *not* system-critical stuff, not '/home/' or anything similar). NFS allows me to watch a movie without first having to copy it to the local drive, but when writing files to the NFS disk I prefer to use rsync. I've therefore mounted my NFS disks readonly, and write stuff over SSH (with rsync). This also stops me from accidentally rsyncing to an NFS mounted disk (which is very inefficient).

    @zrajm how to you mount your disks on the pi?

    `arisu:/mnt/ytra /mnt/ytra nfs soft,ro,intr 0 2`

    Samba may confuse some unix applications, notably around permissions or what `stat()` returns, e.g. things that rely on the `nlink` count which CIFS has no notion of. SSHFS I've been not much impressed with, as it ran context switches on the fileserver up mighty high, and did not support the necessary locking required by in-house programs. So, NFS...

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM