2022-03-10 00:00:00

Technologyclient-server|disk sharing|file sharing|LAN|linux

How to set up disk sharing for Linux computers with NFS

If your home or office is powered by Linux computers, you may want to have a system for sharing files. Our small office has been using file sharing software called NFS (Network File System) for quite some time now, and we are pretty happy with it. Here is a brief how-to guide for setting up NFS file sharing for Linux computers.

NFS was developed by Sun Microsystems for the Solaris product range that was built on Unix. NFS has been around for a long time, and it is considered a solid file sharing software for Linux and Unix operating systems. As time has passed, however, NFS Windows software hasn't kept up with. NFS is designed to provide disk sharing on a LAN (Local Area Network). It is not a cloud service that can be accessed from anywhere with any device.

If you are familiar with the native file sharing functionality in Windows or in Mac, NFS is similar with them. Other disk sharing choices for Linux are Samba and sshfs (command line file access that uses ssh).

NFS is a client-server system. You designate one or more computers as the server, and the others are clients. The server shares a specified disk to clients that can read from and write to (depending on the configuration) the shared disk. The server and clients must be connected to the same LAN.

Installing NFS

In our small office, Linux computers run Debian or a distribution built on Debian, like Ubuntu, and that is the environment where the following instructions have been tested.

Install the NFS server software

The computer that shares its disk requires the server module of NFS. In systems that have apt packaging, the command to install is:

apt-get install nfs-kernel-server

After the software has been installed, you have to tell NFS which disk you want to share. The configuration file's name is: /etc/exports

The file features examples how to specify the disk to be shared. You can use the hostname of the server computer or its IP address in the LAN to specify the shared disk. For instance (edit names to match your system):

/media/username/SSD1TB/docs blackberry(rw,sync,no_subtree_check)
or
/media/username/SSD1TB/docs 192.168.10.0/24(rw,sync,no_subtree_check)

Run the command below to tell the NFS server about the new disk share:

exportfs -ra

You can verify that NFS server understood what you wanted to say:

exportfs -s

Install the NFS client

Computers that access the shared disk need a client software that is installed like this:

apt-get install nfs-common

Once the client has been installed, you can mount the shared disk specified on the server as a local disk for the client (here, /media/username/nfsshare is the local name the client accesses). You may have to create the mountpoint directory first (in this case: mkdir /media/username/nfsshare), and then run:

mount -v -t nfs blackberry:/media/username/SSD1TB/docs  /media/username/nfsshare/

If it doesn't work but throws error messages like:

mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting

Try and specify the NFS version for the mount command:

mount -v -t nfs -o nfsvers=3 blackberry:/media/username/SSD1TB/backup /media/username/nfsshare/

Troubleshooting

If your NFS client was able access a shared NFS disk but the connection hangs up (in the worst case, your computer freezes), it may mean that the connection has broken down or the server has been shut down. Try to force disconnect from the NFS server:

umount -f /media/username/nfsshare
or
umount -l /media/username/nfsshare

You can display the mounted disks on the client:

df -h

On the server, check the status of the NFS server:

systemctl status nfs-server

And restart NFS server if needed:

systemctl restart nfs-server

Also on the server, verify what is shared:

showmount -e hostname (or ip address instead of the hostname)

This article has more tips for troubleshooting.

NFS on Windows

NFS client applications such as FreeNFS and NFSClient are available for Windows PCs, but getting them to run on recent versions of Windows seems to be tricky. We only tried them briefly and didn't succeed, but if someone has managed to get them to work, please share your tips.

News

2025-01-15 08:59:00

Not to mention travel – when real life experiences in a destination don’t match the expectations and everything that can go wrong, goes wrong. Well, that’s the beauty of #travel. #Europehttps://klaava.com/nitpickers-travel-journal-travel-lessons-learned-in-2024/


News

2025-01-11 13:25:00

A conclusion from the Traffic Scorecard 2024 results is it takes about double the time to drive along the streets of London (the most congested city in #Europe) than the streets of Munich, which is ranked the 21st most congested European city. #traffic #travelhttps://klaava.com/the-cities-in-europe-where-people-are-stuck-in-traffic-most-often/


A shop dedicated to tasty juice

2025-01-09 14:04:10

arihak

A shop dedicated to tasty juice


in the busy old town center.

2025-01-08 16:16:08

in the busy old town center.


News

2025-01-07 14:56:00

A reminder for keeping your data safe when traveling. Why? It is likely that you have to access your most critical data in risky situations on the road.https://cybernews.com/privacy/how-to-protect-your-sensitive-information-while-traveling/


News

2025-01-02 16:33:00

What about the scenery, you who are hurrying to the other side?#streetphotography#streetphoto


News

2025-01-01 16:06:00

According to a survey, third of travelers are victims of online booking scams. Since it is so convenient to make travel reservations online, that’s what we do. The problem is that we haven’t adopted new methods to avoid online scams. #travel #scamhttps://klaava.com/a-traveler-is-more-likely-to-get-scammed-when-booking-a-trip-than-being-robbed-in-a-destination/


Perhaps road builders had too much time?

2024-12-29 15:19:44

Perhaps road builders had too much time?


News

2024-12-27 18:25:00

#Photography is full of so-called “rules” that can feel overwhelming. However, some of these “rules” are downright myths.https://www.diyphotography.net/debunking-seven-common-myths-photographers-still-believe-in/


What should I read next?

2024-12-25 15:18:22

arihak

What should I read next?


News

2024-12-23 11:34:00

Since #EU #DMA has specified #Apple as a #gatekeeper in #mobile devices, EU considers Apple should implement several iOS connectivity features, predominantly used for and by connected devices. For instance, notifications, automatic Wi-Fi connection, AirPlay, AirDrop, or Bluetooth audio switching.https://digital-markets-act.ec.europa.eu/commission-seeks-feedback-measures-apple-should-take-ensure-interoperability-under-digital-markets-2024-12-19_en


News

2024-12-21 14:51:00

Smartphone users in the US are not impressed with the latest artificial intelligence features on their devices with 73 percent of Apple users and 87 percent of Samsung users unsatisfied, according to a new study. #phone #AIhttps://petapixel.com/2024/12/19/majority-of-smartphone-users-are-unimpressed-with-ai-features-study-finds/


There should be enough ice already to open the hotel

2024-12-20 16:40:17

There should be enough ice already to open the hotel


Hiking on a mountain experience: the end of an ancient tunnel

2024-12-09 14:12:31

arihak

Hiking on a mountain experience: the end of an ancient tunnel


on a hot summer day

2024-12-02 18:47:01

on a hot summer day


Cloudy day in a valley

2024-11-25 16:31:59

arihak

Cloudy day in a valley


In the shade of a lone palm tree

2024-11-25 15:46:29

In the shade of a lone palm tree


an abandoned town?

2024-11-07 18:35:22

an abandoned town?


A quiet moment between heavy rain

2024-10-24 17:34:45

A quiet moment between heavy rain


Everyone loves a pretty mountain scenery

2024-10-24 16:54:02

arihak

Everyone loves a pretty mountain scenery