LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-23-2019, 12:09 AM   #1
mackowiakp
Member
 
Registered: Jun 2014
Location: Poland/Gdynia
Distribution: Mageia 9, SH4, Debian
Posts: 367

Rep: Reputation: 8
Can not mount whole filesystem from NFS server for the second time


I export NFS share form server as described in /etc/exports:

Code:
/home/maciek/back/RSYNC 192.168.0.7(rw,no_root_squash,subtree_check,crossmnt)
This is the only entry in /etc/exports file. Both server and client use NFS v4.

Than I have such entry in fstab of NFS server:

Code:
LABEL=4TB /home/maciek/back/RSYNC ext4 user,noauto,defaults,noatime 0 0
HDD with LABEL=4TB is USB v3 connected external disk with one ext4 partition.

I use all of it for off-line backup, running from script. The script works as follows:

1 - mount USB HDD on server to /home/maciek/back/RSYNC dir using command:

Code:
/bin/mount LABEL=4TB
2 - client mount /home/maciek/back/RSYNC NFS share using command:

Code:
/bin/mount -w -v -t nfs -o rw -O user=root.password=pass 192.168.0.2:/home/maciek/back/RSYNC /share/CACHEDEV2_DATA/mnt
3 - script backup desired files using rsync
4 - client umount NFS share using command:

Code:
/bin/umount /share/CACHEDEV2_DATA/mnt
5 - server umount USB HDD:

Code:
/bin/umount -l $dev
$dev is formerly calculated device name of USB HDD ext4 partition.
When umount command has no "-l" option, it does not umount HDD partition because device is busy.
lsof for /home/maciek/back/RSYNC shows nothing.

Than I run the same script again. And it hangs when client try to mount NFS share from server.
The only solution I found so far is to restart nfs-server service on server.

So what I am doing wrong that mounting NFS share for the second time hangs? All logs shows that both NFS and local mounts are properly dismounted. If any additional info are necessary, will post ASAP.

Last edited by mackowiakp; 12-23-2019 at 12:15 AM.
 
Old 12-23-2019, 05:42 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Looks like the nfs table might get screwed up by unmounting the drive. I might try removing it from the nfs table with the exportfs command before unmounting and adding the exportfs command prior to mounting in your script.
 
1 members found this post helpful.
Old 12-23-2019, 08:31 AM   #3
mackowiakp
Member
 
Registered: Jun 2014
Location: Poland/Gdynia
Distribution: Mageia 9, SH4, Debian
Posts: 367

Original Poster
Rep: Reputation: 8
Yep. Logic will take you from A to B. So - I hope - from B to A too ;-)
So. I A is a NFS server (PC based) and B is a NFS client (QNAP NAS) I have a problem described above.
But if B is a server and A is a client, it is possible to mount/umount any share without problems.
It takes me to assumption that something is misconfigured on A. That is on PC based NFS server.
The question is what.
 
Old 12-23-2019, 08:51 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
I have not tested your steps but I believe the problem is due to you unmounting the hard drive and the nfs server getting confused. Check the log files.

My suggestion is to remove the share using exportfs before unmounting the hard drive.
 
1 members found this post helpful.
Old 12-23-2019, 08:57 AM   #5
mackowiakp
Member
 
Registered: Jun 2014
Location: Poland/Gdynia
Distribution: Mageia 9, SH4, Debian
Posts: 367

Original Poster
Rep: Reputation: 8
OK. Will test everything without mounting/dismounting USB HDD, simply by automount this drive in fstab, during boot - as every HDD.
 
Old 12-24-2019, 01:11 AM   #6
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,793

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
You must
exportfs -u /home/maciek/back/RSYNC
prior to
umount /home/maciek/back/RSYNC

The correct order is
mount, exportfs -a, client-mount
And
client-umount, exportfs -u, umount

Do not use -l for umount! (It is a last resort, a bit like "kill -9").
If the exportfs -u cannot release it, search for accessing processes with

fuser /home/maciek/back/RSYNC
lsof /home/maciek/back/RSYNC

If you have to frequently kill an accessing process, try to kill it with

fuser -k /home/maciek/back/RSYNC
 
1 members found this post helpful.
Old 12-24-2019, 02:44 AM   #7
mackowiakp
Member
 
Registered: Jun 2014
Location: Poland/Gdynia
Distribution: Mageia 9, SH4, Debian
Posts: 367

Original Poster
Rep: Reputation: 8
THX @michaelk and @MadeInGermany. Looks to be solved. The trick was to use "exportfs -u".

Merry Christmas from Poland !! All I want for Christmas is June !!!

Last edited by mackowiakp; 12-24-2019 at 02:55 AM.
 
  


Reply

Tags
fstab, nfs, nfs exports



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] NFS server: mount.nfs: mount(2): Protocol not supported Bill_Blessing Linux - Newbie 13 06-18-2019 01:30 PM
NFS Mount not working: mount.nfs: Operation not permitted Jim44 Linux - Networking 6 03-25-2019 07:07 AM
Mount NFS error - mount.nfs: mount(2): Permission denied ndtatlive SUSE / openSUSE 1 09-20-2018 10:46 PM
how to mount a nfs mount from linux client to AIX nfs server dennyqian AIX 13 04-11-2016 11:30 PM
[SOLVED] NFS mount fails (times out): NFS server is in DMZ, NFS client is in intranet Hiroshi Linux - Networking 2 05-24-2010 10:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration