This is the mail archive of the
mailing list for the Cygwin project.
Re: 1.5.12: mt sees incorrect maximum block size
On Dec 14 14:36, Richard Simon wrote:
> when I attempt to set the correct block size with mt (or try to do so with tar) I am unable to do so.
> mt status 2 reports a maximum block size of 65535, whereas the windows driver and the winTarSCSI utility both report a much larger maximum block size of 16777214
> I can use the winTarSCSI utility to write tapes with a block size of 262144, but tar under cygwin will not write with a block size larger than 65535.
Now that you mention it...
While rewriting the Cygwin tape driver code a couple of months ago, I
found the same problem. I've just drawn the wrong conclusion.
According to the documentation, my Tandberg SLR7 drive is capable of
writing 262144 byte blocks and the XP drivers properties dialog also
reports a max block size of 262144.
But the Windows function reports 65536 as maximum block size. Yes, it's
actually Windows which returns that value. I just wrote a small
testcase(tm), which verifies that without involving Cygwin.
======== SNIP ========
main (int argc, char **argv)
DWORD len, err;
HANDLE fh = CreateFile ("\\\\.\\tape0", GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (fh != INVALID_HANDLE_VALUE)
if (argc > 1)
smp.BlockSize = strtoul (argv, NULL, 0);
if (smp.BlockSize > 0)
printf ("Try setting BlockSize to %lu\n", smp.BlockSize);
while ((err = SetTapeParameters (fh, SET_TAPE_MEDIA_INFORMATION,
(void *) &smp))
printf ("SetTapeParameters returned Win32 error %lu\n", err);
len = sizeof dp;
while ((err = GetTapeParameters (fh, GET_TAPE_DRIVE_INFORMATION,
&len, &dp)) == ERROR_MEDIA_CHANGED)
printf ("DefaultBlockSize: %lu\n", dp.DefaultBlockSize);
printf ("MinimumBlockSize: %lu\n", dp.MinimumBlockSize);
printf ("MaximumBlockSize: %lu\n", dp.MaximumBlockSize);
len = sizeof mp;
while ((err = GetTapeParameters (fh, GET_TAPE_MEDIA_INFORMATION,
&len, &mp)) == ERROR_MEDIA_CHANGED)
printf ("CurrentBlockSize: %lu\n", mp.BlockSize);
======== SNAP ========
$ gcc mt-test.c -o mt-test
$ ./mt-test 65536
Try setting BlockSize to 65536
$ ./mt-test 131072
Try setting BlockSize to 131072
SetTapeParameters returned Win32 error 87
So, as you can see, the Windows NT tape functions doesn't allow me to set
the block size to more than 64K, too. That's the same functionality used
inside of Cygwin. I have no idea how to workaround that. I also didn't
find anything useful on the Web so far.
I'd *love* to get that solved, but I don't know how. I'm going to ask
someone who's writing tape drivers for Windows, perhaps he has a clue.
Other than that, I'm open to any useful hint from the community.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader mailto:email@example.com
Red Hat, Inc.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html