Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

data loss when moving files to NFS mounted directory

Status
Not open for further replies.

huskers

Programmer
Jan 29, 2002
75
US
I am seeing data loss when moving files to NFS mounted directory. I use the mv command to move the files from a directory to a NFS mounted directory. Is there a better way to do this. There is a process running continously which reads files from NFS mounted directory and processes it and deletes it. Is there a possibility that when I am moving the files to NFS mounted directory the process reads the partial written files and processes it.
 
Pretty much not likely. What kind of filesystem is the NFS mount?

Normally any UNIX to UNIX mounts are bullet-proof, and any problems are due to a misbehaved app. ie file opens/writes and reads are not being checked for the return code.

 
It is just a C program which reads files from the NFS mounted directory and loads it into database.

I have a question, i just looked at mv command source code and it does cp and then rm. In the copy code i saw it does a read from oldfile to iobuffer and the write from iobuffer to newfile. Will this be different when writing on NFS mounted directory.
 
everything is on Linux. I want to know how cp command works when copying a file from local machine to NFS mounted directory. Does NFS have any different buffers to which the cp command writes which then need to be flushed out to the new file.
 
I would think that NFS should not be any different.
On the cp, does if check $? status before the rm?

In the program are the return codes checked?

check out the flock function.

There is also a non-block/block mode. tail -f works like this. When tail hits the eof, it goes to delay, and whenever a write is completed, it then presents the user with the written data. Essentially the fread goes to sleep and waits for more data, The other way it returns a -1.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top