lkml.org 
[lkml]   [2000]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] zip drives
People complain about the kernel error message
"hdb: The drive reports both 250609664 and 100663296 bytes as its capacity"
Some are even so much worried that they ask whether they should exchange
the disk or drive they bought, or claim that Linux does not work with
this disk.

Maybe things are like this:
The drive itself reports a geometry, regardless of whether
a floppy is present or not. That is pure friendliness -
it means that when systems listen to this advice they will
all use the same geometry, and that is good.

The removable disk does not report a geometry, but it reports
a size.

Thus, in ide-floppy.c: idefloppy_get_flexible_disk_page()
page->CHS is the advised geometry the drive invents,
and floppy->blocks * floppy->block_size is the actual size
of the floppy.

When no removable disk is present the former is unchanged,
the latter becomes 0.

This means that the above-quoted error message unnecessarily
worries people in a completely normal situation, and we have to
change things a bit. Unfortunately I do not know anything about
ZIP disks, have never seen one myself, so the appropriate change
is not entirely clear to me.

I think the entire fragment of code

lba_capacity = floppy->blocks * floppy->block_size;
if (capacity != lba_capacity) {
printk (KERN_NOTICE "%s: The drive reports both %d and %d bytes as its capacity\n",
drive->name, capacity, lba_capacity);
capacity = IDEFLOPPY_MIN(capacity, lba_capacity);
floppy->blocks = floppy->block_size ? capacity / floppy->block_size : 0;
}

can be deleted, but a more cautious approach would be the following:
(pasted from another window - tabs will have become spaces)

--- .../linux-2.3.51/linux/drivers/block/ide-floppy.c Tue Mar 7 19:53:33 2000
+++ ./ide-floppy.c Mon Mar 13 21:36:50 2000
@@ -1226,10 +1226,10 @@
drive->bios_head = page->heads;
drive->bios_sect = page->sectors;
lba_capacity = floppy->blocks * floppy->block_size;
- if (capacity != lba_capacity) {
- printk (KERN_NOTICE "%s: The drive reports both %d and %d bytes as its capacity\n",
- drive->name, capacity, lba_capacity);
- capacity = IDEFLOPPY_MIN(capacity, lba_capacity);
+ if (capacity < lba_capacity) {
+ printk (KERN_NOTICE "%s: The disk reports a capacity of %d bytes, "
+ "but the drive only handles %d\n",
+ drive->name, lba_capacity, capacity);
floppy->blocks = floppy->block_size ? capacity / floppy->block_size : 0;
}
return 0;
Linus, I think you can apply this - it does not change behaviour
but gives fewer messages, causing fewer worried people and assistance calls.
Maybe later we can remove the if-statement altogether.

Andre, do you agree? Do you know what happens with a 250 MB disk
in a drive that expects 100 MB disks?

I hope people who know this stuff or have this hardware
will correct the info given below.

Andries



-----
Archive of evidence reported so far:
A. Size and geometry

non-present disks have a capacity of 0 bytes
100MB disks have a capacity of 100646912 bytes, i.e., 196576 sectors
250MB disks have a capacity of 250640384 bytes, i.e., 489532 sectors
LS120 disks have a capacity of 126222336 bytes, i.e., 246528 sectors

The geometry of a SCSI drive for 100MB disks is reported (on Solaris)
as 96/64/32 (on an Adaptec controller), 1024/4/48 (on an NCR controller);
both geometries yield 196608 sectors.
The geometry of an IOMEGA ZIP 100 ATAPI FLOPPY drive is reported as
96/64/32.
These geometries correspond to 196608*512=100663296 bytes
Since the disk itself only claims 100646912 bytes, there might
be an inaccessible final 16 KiB in case fdisk really uses 96/64/32.
If this is really true, fdisk should use 95/64/32 or so.

The geometry of an IOMEGA ZIP 250 ATAPI FLOPPY drive is reported as
239/64/32 corresponding to 489472 sectors or 250609664 bytes.
Thus, this time the drive claims 30 KiB less than a 250 MB disk.

The geometry of an LS120 drive is reported as 963/8/32
corresponding to the same 126222336 bytes that the disk reports.

In the case of a 100MB disk in a 250MB drive it is reported
that the drive reports 250609664 bytes as expected, but the
disk suddenly reports a surprising 100663296 bytes.
[Can somebody clarify?]

B. The partition table

Many reported complaints can probably be explained if we
assume that under Windows there is no partition table
(or at least not the usual one), for example, if the
ZIP disk is treated like a big floppy.
Is this the case?

C. People report errors on the final part of the disk.
Maybe there is an error in our code somewhere.

[Or was - quite possibly these problems have all been
fixed in the meantime - I never looked at ZIP disks before.]

-----
A bug report (bennog@dolfijn.nl, 02/06/2000):
Try copying the full 250Mb to the zip and then reading it back.
The reading back loses the last 4kbytes for some reason. For us
this is a BIG problem. I have written a little test program
which writes unike blocks of 1024 bytes to one file until there is
no space left. Then flush the cache and read back from the zip.
The reading back misses the last 4kbytes written to the zip.
The same test works ok on ZIP 100. This is a bit of a problem for us.
-----
David H. Lee (davelee@ranma.mindspring.com, 12/30/1999) writes:
"The drive reports both 250609664 and 250640384 bytes as its capacity"

Should I be concerned about this? Sometimes I also get FAT errors -
on the last block (or last block + 1) of the ZIP disk that I'm using.
-----
Paul Taylor (birder@ozemail.com.au, 01/29/2000) writes:
I bought a ZIP 250 ATAPI internal drive last night, and had the same problems
(i.e. I/O errors, errors reading partition table, FAT bread errors etc.)
Curiously, when I fired up Linux this morning to investigate the problem further,
it worked fine using the IDE-FLOPPY module! The ZIP disk mounted correctly,
I could copy files to and from the disk, and it ejects with the eject command.
What I think did the trick was deleting all files on the ZIP disk (*including the
factory-installed README file*) under Win98.
-----
Several others report:
hdd: The drive reports both 100663296 and 100646912 bytes as its capacity
hdd: hdd1 hdd2 hdd3 hdd4
ide-floppy: hdd: I/O error, pc = 28, key = 5, asc = 21, ascq = 0
end_request: I/O error, dev 16:44 (hdd), sector 0
FAT bread failed
-----
hdd: The drive reports both 100663296 and 100646912 bytes as its capacity
hdd: hdd1 hdd2 hdd3 hdd4
>> Pero' poi lo zip funziona regolarmente, anzi quasi regolarmente, se
>> formatto uno zip con fat msdos, succedono casini (errori, fs
>> illeggibile ...) con ext2fs, tutto bene tranne i messaggi di cui
>> sopra. Anche con win95 non riesco a formattare, ma lo posso usare
>> normalmente con dischi gia' formattati.
-----
> ESATTAMENTE! Anch'io sto avendo gli stessi problemi! Ho rimediato,
> in parte, ricompilando il kernel senza l'opzione IDE FLOPPY
> (CONFIG_BLK_DEV_IDEFLOPPY) ma con l'emulazione SCSI (CONFIG_BLK_IDESCSI)
> cosi' ora lo ZIP sta sulla /dev/sda4. In questo modo con ext2fs non da
> alcun messaggio di errore e sembra funzionare alla perfezione, mentre
> non ne vuole sapere di montare msdosfs o fat32fs! Per utilizzare le stesse
> cartucce in Winzozz devo per forza riformattarle con le sue utility.
-----
> We are having file corruption problems with ZIP drives too.
...
> Also a desktop we have with an internal ATAPI ZIP will not mount
> a Win98 formatted vfat disk. If I run fdisk on it, I get all 4 partitions
> and a bunch of warnings. Removing all partions and making partition 4,
> type 6, then using mkfs to make a dos partion seems to work for Linux,
> but the disk is not readable under Windows. A Windows reformat messes
> up the partition table and makes a disk that is not readable under Linux.
-----
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.554 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site