Home > Linux > Mounting nfs share on boot

Mounting nfs share on boot

Have you encountered that your mounted nfs folder disappeared after the server reboot (for whatever reason)?

Very frustrating huh?!

I will show you how to mount and will not lose the connection.

Let’s check what are the shared folder exported from our NFS server.

# showmount -e <nfs.server.ip.address>
The program ‘showmount’ is currently not installed.  You can install it by typing:
apt-get install nfs-common
showmount: command not found

Arg!!! showmount is not installed.  Have to install it first using apt-get.

# apt-get install nfs-common

Now we can view the shared folder from our NFS server.

# showmount -e <nfs.server.ip.address>
Export list for <nfs.server.ip.address>:
/mnt/<shared_folder> <nfs.server.ip.address>/255.255.255.0

Let’s try to mount it to test if we will not encounter any problem in mounting the shared folder.

# mount <nfs.server.ip.address>:/mnt/<shared_folder> /home/<user>/<new_folder>

We can check the newly mounted share using df.

# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda3             48425796   3339580  42626264   8% /
udev                    509032       248    508784   1% /dev
none                    509032         0    509032   0% /dev/shm
none                    509032       112    508920   1% /var/run
none                    509032         0    509032   0% /var/lock
none                    509032         0    509032   0% /lib/init/rw
<raid.server.ip.address>:/mnt/<shared.folder> 511900416 139367936 346531840  29% /home/<user>/<new_folder>

Neat! It was mounted without any problem.

Mounting it without losing it on boot is not that hard.  We have to edit the /etc/fstab

# vi /etc/fstab

Add this line at the bottom the details that you saw when you viewed the shared folder from our NFS server (see above).

<raid.server.ip.address>:/mnt/<shared.folder>       /home/<user>/<new_folder>       nfs     rw  0       0

Reboot the server and watch the magic as it happens.

Check the mounted shared folder using df.

Neat!

Categories: Linux
  1. April 6, 2014 at 10:20 am

    My spouse and I stumbled over here different website and thought I
    should check things out. I like what I see so now i
    am following you. Look forward to exploring your
    web page yet again.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: