Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Why a dot file cannot be deleted after running a Java program?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Douglas Wells  
View profile  
 More options Oct 2 2007, 10:39 pm
Newsgroups: comp.lang.java.programmer
From: s...@signature.invalid (Douglas Wells)
Date: Tue, 2 Oct 2007 22:39:06 -0400 (EDT)
Local: Tues, Oct 2 2007 10:39 pm
Subject: Re: Why a dot file cannot be deleted after running a Java program?

In article <fdu80m$bf...@news.nems.noaa.gov>, www <w...@nospam.com> writes:
> I have noticed that after running my Java program, there is a dot file
> that cannot be deleted. (I use linux). Following is the screen shot:

> $ls -a
> .  ..  .nfs009da645000007c3
> $rm .nfs009da645000007c3
> rm: remove regular file `.nfs009da645000007c3'? y
> rm: cannot remove `.nfs009da645000007c3': Device or resource busy

> I guess that I didn't close some PrintWriter or what. The Java program
> ends normally. Can you give me some suggestions?

This file is an artifact of the NFS (network) file system that you
are almost certainly using.  This type of file entry is created
when a normal file is deleted (unlinked) while some process
(presuming your Java program) has it open.  This is a common
strategy for creating of temporary files by UNIX programs.  If you
were using the file on a local file system, the removal would
simply result in a "file" that still existed but did not have a
file system entry.  The advantage of this strategy is that the OS
will remove the "file" when the file is closed -- even if the close
is caused by an abnormal exit.

NFS was designed as a "state-less" file system.  This has several
advantages, but one of the disadvantages is that is doesn't handle
"state-ful" operations.  This type of removal requires the retention
of the knowledge that the original file system entry has been
removed, but the data must still be retained.  NFS handles this
by renaming the original file to the form ".nfs<something>" instead
of actually removing it.

It should go away when the process completes, but if it doesn't
for some reason, there are a couple of options.  On many/most
systems that serve NFS clients, there is a daemon job that sweeps
the file systems and deletes such files after a couple of days.
If you are sure that no programs are still active that might access
this file, it is safe for you to delete it yourself -- although
if you do this while some process still have the file open, you
will simply iterate on the creation of the strangely named files.
You probably also would be able to delete it from a program running
on the server system.

Just a little more detail if you're interested:  The use case to
consider here is that you have an NFS-mounted file open that you
have removed.  Now consider that the server is rebooted for whatever
reason.  Your client-side file system still needs to be able to
reopen the file, and it does so by using the ".nfs<something>"
form of name.

Here are some random references that Google came up witH;
        http://www.cs.indiana.edu/Facilities/FAQ/General/dotnfs.html
        http://www.seas.upenn.edu/cets/answers/nfs-files.html

 - dmw

--
.   Douglas Wells             .  Connection Technologies      .
.   Internet:  -sp9804- -at - contek.com-                     .


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.