Large File Transfers from Windows to Linux to Windows Being Corrupted

In the office, we have a Linux box which we use to delegate access to a certain set of production servers.  CIFS mount points are shared out through FTP, allowing us to control who can access what.

We recently ran into a problem.  A few large zip files were transferred to production and I was asked to unzip them.  The first set of four zip files were unable to be extracted, reporting a premature end of file.  I had the user recompress the files using 7zip (winrar was used originally).  This also did not solve the problem.  Next, we tried a different FTP client. No dice.

Next, I watched a file transfer as it happened.  The users FTP client reported the transfer to be complete; however I noticed some strange behavior.  The transfer was still in progress from what I saw.  On the production Windows server, I watched the file continue to grow for over 100 megabytes and about 3 to 5 minutes after the client reported the transfer as being complete.  This was my first clue that something strange was going on.

It seemed as though there was some sort of caching going on, and I wondered if this was somehow corrupting the files.  After a bit of googling, (term: ftp to cifs share corrupting), I came across this page: Copying large files to CIFS mount (XP) may corrupt data!?

Turns out the problem is exactly the same as his.  Simply remounting the shares with the forcedirectio flag solved the problem.  For example, in fstab, the following line:

//productionserver/share1 /mnt/share1 cifs  credentials=/etc/.cifs,rw 0 0

was changed to

//productionserver/share1 /mnt/share1 cifs  credentials=/etc/.cifs,rw,forcedirectio 0 0

Next I did

umount /mnt/share1
mount /mnt/share1

Then to test, we transferred some large files, performed checksums and all was better in the world.

Blogged with the Flock Browser

No related posts.

Leave a Reply

 

 

 

Subscribe without commenting.