Re: data corruption: revalidating a (removable) hdd/flash on re-insert

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Kay Sievers
Date: Friday, October 31, 2008 - 9:10 am

On Fri, Oct 31, 2008 at 16:38, Michael Tokarev <mjt@tls.msk.ru> wrote:

Maybe your card reader is broken. I can not reproduce this with any of
the many readers I have. Usually a media change results in media
revalidation with the next access to the device. You can easily
reproduce that:

Insert the media, and force a validation:
  $ touch /dev/sdb

Start logging of the kernel uevents to the console:
  $ udevadm monitor --kernel &

Access the device:
  $ touch /dev/sdb

Nothing should happen, as the reader/kernel knows it is still valid.

Now remove the media and insert it immediately again.

Access the device:
  $ touch /dev/sdb
  UEVENT[1225468868.803950] change
/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host8/target8:0:0/8:0:0:0
(scsi)

and you see the reader told to kernel (scsi unit attention) to
revalidate the device.

These events happen only when the device is accessed. That's why
distros poll removable devices for media changes.

Every access to removable media is guarded by this revalidation check.
If you don't see these events, you should not trust this reader, and
at least never change the media while it is connected.

Kay
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: data corruption: revalidating a (removable) hdd/flash ..., Lennart Sorensen, (Fri Oct 31, 8:59 am)
Re: data corruption: revalidating a (removable) hdd/flash ..., Kay Sievers, (Fri Oct 31, 9:10 am)
Re: data corruption: revalidating a (removable) hdd/flash ..., Michael Tokarev, (Fri Oct 31, 10:39 am)
Re: data corruption: revalidating a (removable) hdd/flash ..., Lennart Sorensen, (Fri Oct 31, 11:28 am)