1

I've been experiencing a baffling disappearing file issue on my NAS since I first bought it, and only today after extensive testing do I think I have a handle on what exactly is occurring. I fear there'll be no solution to this, but please, pull up a chair, at least, and listen to my tale of woe.

To begin, I'm running Windows 7 x64 and a QNAP TS-451, but I don't believe either piece of information to be relevant -- under the right circumstances, this should occur on all NASes and all versions of Windows. My NAS filesystem is ext4 (with options rw,usrjquota=aquota.user,jqfmt=vfsv0,user_xattr,data=ordered,nodelalloc,noacl), and I'm accessing my files in Windows via a Samba (v4.0.21) network drive.

To reproduce this issue, I've been creating two folders called test1 and test2, copying a .exe file to test1, quickly cutting and pasting the file to test2, then quickly cutting and pasting the file back to test1. When the file is pasted back to test1, most of the time, nothing occurs, and the file simply remains in test2. Unfortunately, QNAP has been unable to reproduce my issue using these instructions (I'm guessing they're not doing it quickly enough), so they've left the investigation as to why this occurs squarely on my shoulders.

Here's what seems to be happening: I've determined using lsof that there's a brief period of time when you open a folder in Windows where the files aren't open in Windows but are on the NAS. I believe this occurs because Windows opens the file to read its icon, but Samba doesn't close the file immediately when Windows does. When I try to move my file, both Windows and the NAS, therefore, allow it, but a reference to the file remains in its original location until the NAS filesystem is remounted (confirmed with stat <filename>); when I try to move the file back to its original location, nothing occurs because on the NAS, it's already there, and Windows simply chokes without an error message.

Granted, it's rare that I want to move a file somewhere and then immediately back, but this issue manifests in other ways -- try to overwrite a file during the brief window it's still open on the NAS, for example, and not only does the file simply disappear in Windows, you can't write to that filename again until the NAS filesystem is remounted. Deleting a file and attempting to copy another to that location with the same name? Same thing. Worst of all, this behavior completely breaks the .par2 repair process -- QuickPar repairs my fileset, removes the original bad files, tries to rename the new files, and poof, they're gone.

Is there any sort of filesystem option, Samba option, or other general wizardry I can use to lay this issue to rest once and for all? As is, it's making working with my NAS a constant nightmare.

2
  • I'm not sure if there is any relevance, but this is reminiscent of a problem I encountered a number of years ago, where a database index became corrupted on some busy systems: we found it was a fault in the disc firmware handling the internal memory cache. Index updates could mean that the same disc sector was being updated repeatedly, and if an update was in the write queue re-reading the sector returned the previous sector from disc, not the updated value from the write queue. Something similar could be happening here, not necessarily in the disc, but maybe in caches in the network drivers.
    – AFH
    Dec 14, 2014 at 1:51
  • We managed to devise a program which did a succession of read - update - post operations and were able to demonstrate that some of the updates were missed. We solved our problem by avoiding that disc manufacturer, which is probably not very helpful to you, but my experience may suggest a way that you could isolate your problem, maybe with a network trace of packets associated with your file operations. (Before you ask, it was in my former employment and I now have no access to the details of the test program; nor can I remember who made the faulty discs - it was all too long ago.)
    – AFH
    Dec 14, 2014 at 2:13

0

You must log in to answer this question.

Browse other questions tagged .