We are copying large files to the USB disks using CreateFile and write file with file system buffering on. Our write size is not always constant. We found that sometimes the data we wrote is getting corrupted mostly with 2.5 inch USB?s on windows 2008R2/windows 7. What is there any recommend practice for writing large files on the USB disks?
Does file system buffering (FILE_FLAG_NO_BUFFERING) matters here?
By the way I have found the below link which says there is a data corruption, is there a way we confirm this is what happening in our case ?
http://support.microsoft.com/kb/968201
and i don’t see any solution in the KB , i don’t think we change the USB transfer type from a user mode module we might need to build new USB driver i guess.
is there any work around for the same.
thanks in advance.
vijay
Some of the hints:
Pls ensure :
-
File access must begin at byte offsets within the file that are integer
multiples of the volume’s sector size
-
File access must be for numbers of bytes that are integer multiples of
the volume’s sector size. For example, if the sector size is 512 bytes, an
application can request reads and writes of 512, 1024, or 2048 bytes, but
not of 335, 981, or 7171 bytes.
-
Buffer addresses for read and write operations must be aligned on
addresses in memory that are integer multiples of the volume’s sector size.
One way to align buffers on integer multiples of the volume sector size is
to use VirtualAlloc to allocate the buffers. It allocates memory that is
aligned on addresses that are integer multiples of the operating system’s
memory page size. Because both memory page and volume sector sizes are
powers of 2, this memory is also aligned on addresses that are integer
multiples of a volume’s sector size. An application can determine a volume’s
sector size by calling the GetDiskFreeSpace function.
FILE_FLAG_NO_BUFFERING when combined with FILE_FLAG_OVERLAPPED, the flag
gives maximum asynchronous performance
Apart from these, if you can just give some more details about the process
involved, then it will help to give more specific solutions.
Thanks
Anshul Makkar
www.justkernel.com
xxxxx@justkernel.com
On Wed, Apr 21, 2010 at 4:42 PM, wrote:
> We are copying large files to the USB disks using CreateFile and write file
> with file system buffering on. Our write size is not always constant. We
> found that sometimes the data we wrote is getting corrupted mostly with 2.5
> inch USB?s on windows 2008R2/windows 7. What is there any recommend practice
> for writing large files on the USB disks?
>
> Does file system buffering (FILE_FLAG_NO_BUFFERING) matters here?
>
> By the way I have found the below link which says there is a data
> corruption, is there a way we confirm this is what happening in our case ?
>
> http://support.microsoft.com/kb/968201
>
> and i don’t see any solution in the KB , i don’t think we change the USB
> transfer type from a user mode module we might need to build new USB driver
> i guess.
>
> is there any work around for the same.
>
> thanks in advance.
>
> vijay
>
>
> —
> NTFSD is sponsored by OSR
>
> For our schedule of debugging and file system seminars
> (including our new fs mini-filter seminar) visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
–