public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Lord <lkml@rtr.ca>
To: linux-usb-users@lists.sourceforge.net,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	mdharm-usb@one-eyed-alien.net, dbrownell@users.sourceforge.net,
	Andrew Morton <akpm@linux-foundation.org>
Subject: USB storage: corrupted data transfers
Date: Sat, 10 Nov 2007 16:05:40 -0500	[thread overview]
Message-ID: <47361D24.8020708@rtr.ca> (raw)

Something may be broken in USB / usb-storage land.

I've got a 2GB USB stick here.
I want to copy it to an image file on my hard drive:

    cat /dev/sdb > usbkey.image1

Make a second copy, with or without unplugging/replugging the stick:

    cat /dev/sdb > usbkey.image2

After doing this, the two copies *differ*.

So I wrote a little program to compare them and determine *how* they differ,
and the result is very interesting.

Periodically, or or the other file has 8192 *zero* bytes inserted
in place of it's data.   Not replacing it's data, just inserted
into the stream, causing the real data (which follows) to be offset by 8192.

If one skips over the inserted 8192 bytes in the file, the data from that point
onward matches the other file, until another 8192 zeros are encountered.

The total sizes of the two image files match each other,
but that's probably just due to the logic in the 'cat' program.

I wonder where those extraneous pairs of zero pages are coming from?

This makes USB drives somewhat unreliable for backups and the like,
which unfortunately is exactly what just about everybody uses them for.

This (so far) is with 2.6.23.1 (w/slab allocater), and 2.6.24-rc2,
on two different machines (both Intel based, but different chipset, CPU, RAM, ...).

I suspect not all brands/models of USB sticks would give the same results,
but it is rather worrisome that it happens at all.

Mmmmmm  ????

             reply	other threads:[~2007-11-10 21:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-10 21:05 Mark Lord [this message]
2007-11-10 21:20 ` [Linux-usb-users] USB storage: corrupted data transfers Alan Stern
2007-11-10 21:41 ` Mark Lord
2007-11-11  0:06   ` Mark Lord

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47361D24.8020708@rtr.ca \
    --to=lkml@rtr.ca \
    --cc=akpm@linux-foundation.org \
    --cc=dbrownell@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-users@lists.sourceforge.net \
    --cc=mdharm-usb@one-eyed-alien.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox