How to Share Files Between Linux Computers Using NFS
Part 1 of 2:
Creating the Server
- Use NFS (Network File System) to share files between Linux computers on a local network. If you need to share files with Windows or Mac computers, you will be much more successful using Samba.
- Understand how NFS works. When sharing files with NFS, there are two side: the server and the clients. The server is the computer that is actually storing the files, while the clients are the computers that are accessing the shared folder by mounting the shared folder as a virtual drive. NFS will need to be configured on both the server and any client that wants to connect.
- Open the terminal on the server computer. This is the computer that will be hosting the shared files. The server computer will need to be turned on and logged in in order for clients to mount the shared folder. NFS requires using the terminal to install and configure both the server and client.
- Type .sudo apt-get install nfs-kernel-server nfs-common portmap and press ↵ Enter. This will begin downloading and installing the NFS files on your computer.
- After installation, type .dpkg-reconfigure portmap. Select "No" from the menu that appears. This will enable other computers on the network to connect to your shared folder.
- Type .sudo /etc/init.d/portmap restart to restart the portmap service. This will ensure that your changes take effect.
- Make a dummy directory that will be used to share the data. This is an empty directory that will direct the clients to the actual shared directory. This will allow you to change the shared directory on your server later without having to make any changes to the clients.
- Type .mkdir -p /export/dummyname and press ↵ Enter. This will create a directory named dummyname that the clients will see.
- Type pico /etc/fstab and press ↵ Enter. This will open the /etc/fstab file and allow you to automatically mount the shared drive whenever the server boots up.
- Add .sharedpath dummypath none bind 0 0 to the end of the file. Replace sharedpath with the location of the shared drive, and replace dummypath with the location of the dummy directory you created earlier.
- For example, to share the /dev/sdb drive with the clients using the dummy directory created earlier, you would type /dev/sdb /export/Shared none bind 0 0. Save the changes to the file.
- Open the ./etc/exports file. You will need to add your dummy directory as well as the IPs that are allowed to access it to this file. Use the following format to share with all the IP addresses on your local network: /export/dummyname 192.168.1.1/24(rw,no_root_squash,async).[1]
- Use the .sudo /etc/init.d/nfs-kernel-server restart command to restart the NFS server.[2]
Part 2 of 2:
Connecting the Client Computers
- Open the terminal on the client computer.
- Type .sudo apt-get install portmap nfs-common and press ↵ Enter to install the NFS client files.
- Create the directory that the shared files will be mounted in. You can name this whatever you'd like. For example, you can type mkdir /sharedFiles to create a folder called "sharedFiles".
- Type .pico /etc/fstab to open the /etc/fstab file.
- Add .serverIP:sharedDirectory nfs rsize=8192,wsize=8192,timeo=14,intr to the end of the file. Replace serverIP with the IP address of the NFS server computer. Replace sharedDirectory with the dummy directory you created on the NFS server and the local directory you just created. Leave the rest of the values as they are for now.
- Using the above examples, the line might look like: 192.168.1.5:/export/Shared /sharedFiles nfs rsize=8192,wsize=8192,timeo=14,intr.
- Type .sudo /etc/init.d/portmap restart to restart portmap and use the new settings. The drive will automatically mount each time the computer reboots.
- Test the drive by manually mounting it before restarting. Type mount -a and then ls /sharedFiles to see if the shared files are displayed.
- Repeat this process for each connecting computer. You should be able to enter the same settings and successfully connect.[3]
3.5 ★ | 2 Vote
You should read it
- Restore deleted components in Active Directory
- Instructions for installing Active Directory on Windows Server 2008
- Configure the Lightweight Directory Service service - Part 3
- How to install Active Directory in Windows Server 2012
- Prevent deleting data in Windows Server 2003 Active Directory
- Extend the Active Directory schema capabilities in Exchange Server 2007
- Configuring the Lightweight Directory Service service - Part 1
- Configure the Lightweight Directory Service service - Part 4
May be interested
- Why are Linux computers still important?phrases like 'the year of the linux computer' or something like that will probably never appear on the market. does this mean linux computers have no power at all? absolutely not! computers running the linux operating system are still great.
- Microsoft applications on iOS and Android help to share files to computers quicklymicrosoft is preparing to release an application for ios and android that helps users quickly share photos on pc.
- Moving files between Linux systems with SCPwhen transferring files to a remote linux server, you have a few options. one of the best is to use a program called secure copy, or scp, which runs over the ssh protocol to quickly transfer files over the network to the remote system.
- File Management in Unix / Linuxall data in unix is organized in files. all files are organized in folders. these directories are organized in a tree structure that is called the file system.
- Is it possible to run .exe files on Linux?you don't need to trade the appeal of windows software for the stability, security, ease of customization (and even great classic appearance) of linux. in this article, you will be shown how to run windows exe (possibly executable) files and software using the linux operating system. these methods can be applied to any linux distribution, including ubuntu, kali linux, centos and many others.
- How to use Jetdrop to share files up to 10GBjetdrop allows downloading files up to 10gb or 1000 files directly for each share.
- Transfer data between computersmany loyal people use their computers for many years. they can update a few components and solve maintenance-related issues to help the computer always run as best as possible. however, there will be times when you have no way to speed up or solve the problem with your old computer.
- How to fix not seeing computers in Workgrouphow to fix not seeing computers in workgroup. lan connection is one of the common and fast connections, enabling us to share files, share printers ... with fast speed and good security. the connection is not always smooth and sometimes we will encounter the error can not find other computers in a lan workgroup.
- How to share data between 2 computers via LAN?normally, when you need to share data between two computers, we often choose the option of using an intermediary tool, usb or portable hard drive. in addition, you can use the internet. however, if you do not have a usb connection and the network connection fails, what should you do? do not worry. we will show you how to share data between 2 computers via lan (network system used to connect computers in a small range) in the article content below.
- Share files between 2 computers using Target Disk Modetarget disk mode allows you to share files between 2 mac computers together with firewire, thunderbolt 2, usb-c, or thunderbolt 3 (usb-c) ports. this feature is extremely useful when you need to transfer data at a fast rate or if you want to display the files you receive from the computer does not work.