LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 02-24-2012, 03:07 AM   #1
tekra
Member
 
Registered: Aug 2010
Location: Brisbane, Australia
Distribution: Gentoo, Slackware, PCLOS
Posts: 66
Blog Entries: 1

Rep: Reputation: 2
Removing stale NFS file handles.


I'm using rsync in a script to do regular backups, and occasionally encounter "stale NFS file handles" left on the backup USB stick. These cannot be deleted; 'rm' reports 'cannot stat' them. I tried running e2fsck and got a slew of errors, yet the device still seems to function correctly (though I don't rely on it thereafter without doing 'mke2fs').

1. Is there an easy way to remove these?

2. Is documentation available explaining them? I'm pretty technical and understand most filesystem basics, and am intrigued to know how a filesystem entry can exist that can't be stat'ed.

Tekra
 
Old 02-24-2012, 08:51 PM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,653

Rep: Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536
How are you getting stale NFS handles on a USB stick that is presumably local?



Stale NFS filehandles can be removed in the following manner:

- Fixing the NFS server that owns the share
- Rebooting
- umount -f (some OSes)
- umount -l (Linux)
 
Old 02-25-2012, 04:42 PM   #3
tekra
Member
 
Registered: Aug 2010
Location: Brisbane, Australia
Distribution: Gentoo, Slackware, PCLOS
Posts: 66
Blog Entries: 1

Original Poster
Rep: Reputation: 2
> How are you getting stale NFS handles on a USB stick that is presumably local?

My assumption is that rsync uses NFS protocol for its operation since it's primarily a network tool, and doesn't distinguish between local and remote devices.

> Stale NFS filehandles can be removed in the following manner:
> - Fixing the NFS server that owns the share

This is not relevant to the present situation.

> - Rebooting

Transferring the USB stick between computers does not remove them.

> - umount -f (some OSes)

I'm using PCLinuxOS (a Mandriva derivative).

> - umount -l

Again, moving the USB stick between devices doesn't change things.

Thanks for your suggestions. BTW, these occur when a target subdirectory doesn't exist, and neither do the parents. Unlike 'wget', the rsync version I'm using (3.0.4) doesn't have an option to force creation of parent directories, and this appears to be the originating cause. I'm planning to change the script to anticipate this and thus cure the problem, but the technical issue of an invalid and non-removable directory entry is what interests me, since it appears to be a (minor and largely irrelevant) bug in an otherwise mature and robust filesystem.

Last edited by tekra; 02-25-2012 at 04:49 PM. Reason: Additional info supplied.
 
Old 02-25-2012, 07:32 PM   #4
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,653

Rep: Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536
rsync doesn't use NFS. I imagine it doesn't give a whistle what filesystem the src or dest are and just hands those details off to the kernel. If the src or dest are remote, it goes over SSH, but it's filesystem-agnostic.

I'm beginning to think that "stale NFS file handles" is not the actual problem you're having. Can you copy and paste the command you're running and the messages you are getting, verbatim, please.
 
Old 02-26-2012, 04:02 PM   #5
tekra
Member
 
Registered: Aug 2010
Location: Brisbane, Australia
Distribution: Gentoo, Slackware, PCLOS
Posts: 66
Blog Entries: 1

Original Poster
Rep: Reputation: 2
First create new Filesystem on backup device /dev/sdb1 (2GB USB stick):

#> mke2fs /dev/sdb1

Standard output, check contents:

#> ls /mnt/sdb1
lost+found/

Run script (bkp a) which prints the commandline before executing it:

#> bkp a
Cpq -> /mnt/sdb1 [Sony-2G]
rsync -a /ace/ace/ /mnt/sdb1/ace/
rsync -a /ace/bin/ /mnt/sdb1/bin/
rsync -a /ace/htp/cgi/ /mnt/sdb1/htp/cgi/
rsync: mkdir "/mnt/sdb1/htp/cgi" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(576) [receiver=3.0.4]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(632) [sender=3.0.4]
rsync -a /ace/htp/if/ /mnt/sdb1/htp/if/
rsync: mkdir "/mnt/sdb1/htp/if" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(576) [receiver=3.0.4]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(632) [sender=3.0.4]
rsync -a /ace/www/ /mnt/sdb1/www/
#> umount /dev/sdb1

Note FYI: the trailing slash on the source pathspec prevents creation of the top-level directory (/ace/).

Move device to another computer and mount as /dev/sdc1:

[sdc1># ls -l /mnt/sdc1
drwxr-xr-x 7 root root 4096 Dec 10 07:26 ace/
dr-xr-xr-x 4 root root 4096 Feb 26 09:42 bin/
drwx------ 2 root root 16384 Feb 26 15:12 lost+found/
drwxrwxrwx 33 root root 4096 Feb 15 17:34 www/

Note that htp/cgi/ and htp/if are missing as per the previous error messages. Then execute rsync in this new environment:

[sdc1># rsync -a --delete -v /ace/ /mnt/sdc1

This produces a slew of error messages similar to those above. When listed after command completion:

[sdc1># ls -l /mnt/sdc1
ls: /mnt/sdc1/doc: Stale NFS file handle
ls: /mnt/sdc1/htp: Stale NFS file handle
ls: /mnt/sdc1/pub: Stale NFS file handle
ls: /mnt/sdc1/tmp: Stale NFS file handle
ls: /mnt/sdc1/wwb: Stale NFS file handle
total 48
drwxr-xr-x 7 root root 4096 Dec 10 07:26 ace/
drwxrwxrwx 13 root root 4096 Feb 26 13:25 arc/
dr-xr-xr-x 4 root root 4096 Feb 26 09:42 bin/
drwxr-xr-x 2 root root 4096 Feb 26 09:40 cfg/
lrwxrwxrwx 1 root root 14 Feb 26 15:14 cur -> /work/ETUFO/Ra/
drwxr-xr-x 2 root root 4096 Jan 23 08:40 dat/
lrwxrwxrwx 1 root root 9 Feb 26 15:14 img -> home.html
drwx------ 2 root root 16384 Feb 26 15:12 lost+found/
drwxrwxrwx 3 root root 4096 Jan 30 18:52 net/
drwxr-xr-x 2 root root 4096 Feb 13 11:54 web/
drwxrwxrwx 33 root root 4096 Feb 15 17:34 www/
[sdc1># rm doc
rm: cannot lstat `doc': Stale NFS file handle
[sdc1># file doc
doc: cannot open `doc' (Stale NFS file handle)
[sdc1>#

Thanks for your interest. Over to you.
 
Old 02-26-2012, 05:46 PM   #6
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,653

Rep: Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536
Sorry, that's a new one, and I have no idea how it could happen that way.

Try a different USB stick? PC? ext3 or 4 instead of 2?
 
Old 02-27-2012, 01:28 AM   #7
tekra
Member
 
Registered: Aug 2010
Location: Brisbane, Australia
Distribution: Gentoo, Slackware, PCLOS
Posts: 66
Blog Entries: 1

Original Poster
Rep: Reputation: 2
> Sorry, that's a new one, and I have no idea how it could happen that way.

OK, that's encouraging of the idea that I should bother the developers with it.

> Try a different USB stick?

Have done, same result.

> PC? ext3 or 4 instead of 2?

Am an aging stick-in-the-mud. Still using KDE3.5, hate 4.5 as a glitzy dog of an interface, less useful and intuitive.

I think there's a bigger problem here; even Linus Torvalds is now complaining that Linux has become "bloated", and I believe that it's well past time for its more mature proponents to call a halt to mere novelty-inpired "improvements" and look to consolidation - never an easy ask.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Stale NFS file handle nodopro Linux - Newbie 5 01-22-2010 12:17 PM
NFS stale file handle and not using NFS odjb Linux - Newbie 3 11-05-2009 10:41 AM
ls: cannot access /etc/resolv.conf: stale nfs file handle - but i'm not using nfs schneidz Linux - General 4 10-02-2009 03:39 PM
Robust NFS file handles traene Programming 2 03-29-2007 07:36 AM
Stale NFS file handle toneys Linux - Networking 1 10-24-2004 03:36 PM


All times are GMT -5. The time now is 09:53 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration