Intro
Hello Folks, Today We're going to learn one of the cool things in Linux and that is mounting an external Network share.
Setting up the Share
Provided you have the share already. I'll be showing here how to mount the share.
CLI
First, you'll want to make sure you have NFS Client installed.
- Debian/Ubuntu:
sudo apt update
sudo apt install nfs-common
- CentOS/RHEL:
sudo yum install nfs-utils
Once that is done we'll need to make a Mount Point for this.
- That can be done like this
sudo mkdir -p /mnt/nfs_share
sudo mount -t nfs nfs_server_ip:/path/to/nfs_share /mnt/nfs_share
mount -t nfs
- Issues the mount command with the type ofnfs
.nfs_server_ip
- The IP of the server./path/to/nfs_share
- Path on the target server./mnt/nfs_share
- Where the Share will be mounted on the server.
Once that is done we can test to make sure the share is mounted correctly by running a
df -h | grep nfs
/etc/fstab
.
echo "192.168.1.100:/export/shared /mnt/nfs_share nfs defaults 0 0" | sudo tee -a /etc/fstab
Running that snippet will add it to that file but please change the variables as most likely you're mount is not the exact same as the example.
After that is done go ahead and run a tail /etc/fstab
to make sure the line has been added to the file. If you see the line you added you're all set then just issue a mount -a
and you'll be all set. If you have any lines that you don't want re mounted make sure they are commented out or just run sudo mount /mnt/nfs_share
to mount that specific entry.
After that is all done the mount should stay persistent even after reboots.
Cockpit
I've shared this video here found on YouTube to better show how it'd done. While it is old the only difference is instead of the +
in storage there is a hamburger menu instead.
Epilogue
With all that being said, this is how you can mount shares in Linux. I hope you learned something here, and make sure to come back for more tutorials.