Re: Slow USB storage device?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Fri, 15 Jan 2010, Kay Sievers wrote:
> 
> blkid is udev's native tool, and we need to use it. But we need to
> optimize its use with devices like this, I guess. It's similar to
> plain old floppy drives which do not behave well when tried to read
> all sort of signatures at random places. :)

Well, to be fair, neither do some USB devices. Lots of them lock up if you 
probe them beyond the end, which is why the kernel has various fixups to 
make sure that the size is right etc.

> The devkit-disks-part-id thing is part of DeviceKit-disks, the HAL
> successor, and does only parse the partiton table in the first blocks
> of the volume, and nothing else. This tool will entirely go away and
> be replaced by the (now existing) partition table parsing code in
> blkid.

Ok. So the only thing worth looking at is blkid.

> >  - What am I supposed to do with a disk that has no UUID? It doesn't get
> >   mounted by hald at all.
> 
> On GNOME, it should be Nautilus which requests the mount from the
> DeviceKit-disks service. HAL is not used anymore, and is expected not
> to be needed in future distro releases like Fedora 13.
>
> Nothing should depend on a UUID found on the volume to trigger
> automounting. The stuff you've shown earlier:
>   $ blkid -o udev -p /dev/sdc1
>   ID_FS_TYPE=vfat
>   ID_FS_USAGE=filesystem
> should be enough to make automounting work.

Hmm. So it might be the odd timing pattern after all, and maybe udev ends 
up announcing the device too early or something. And it ends up being 
noticeable only when the disk is _so_ slow that even reading some minor 
data off it takes half a second.

Is there some way to get a trace of what these tools do to figure out what 
goes wrong?

> > And no, I can't just add a UUID to the thing. It's a piece of external
> > hardware with odd firmware that I don't control.
> 
> Yeah, seems odd, that this does not work, event when it would take a
> minute. Does it show up in Nautilus, so that you can click on an icon
> to mount it, or does it not show up at all?

It does not show up at all. And I have no idea why, because the whole 
udev->DeviceKit thing is pretty invisible to me (see above on the "is 
there some way to see what's going on" question ;)

> After all has settled, does:
>  devkit-disks --dump
> print anything useful about this device?

Appended. 

> Let's find some possible way to optimize this behavior. It seems all
> comes down to optimize the blkid usage, as HAL should go away (or at
> least get crippled not to matter anymore) before the next release
> anyway.
> 
> How large is the volume? If it's very small, maybe we could add logic
> to skip the probing for any RAID stuff, which can not really exist on
> such small volumes.

It's tiny. It's half a megabyte - so the "read 120kB to figure out what 
format it is" (ok, so blkid only reads ~70kB, but the kernel rounds it up) 
is literally a quarter of the whole disk!

So in "how long does it take to read the whole disk" terms, this device 
isn't all that slow. 

> Should we disable or limit the read-ahead logic with BLKRASET? That
> might possibly cut the time down to the half, right?

I agree that maybe that could be a part of the answer (since we know that 
read-ahead isn't going to help), but even just 70kB is quite a bit to read 
when you get just 15kB/s or so.

It would likely cut down that 8+ seconds for that one long read to just 
4.5s, but with all the other reads (blkid also probes at the end etc) it 
would be closer to ten seconds (rather than the current 13s+) and then 
doing it twice (once for the raw disk, once for the partition) would 
_still_ be unbearably long.

So for something like this, that looks more like a partitioned (and slow) 
floppy than anything else, the only real solution is to read much less.

			Linus

---

..
.. deleted sda/sdb information - they're the internal disks ..
..
.. The problematic disk is sdc, and this also shows a workding 
.. usb memory stick at sdd
..

========================================================================
Showing information for /org/freedesktop/DeviceKit/Disks/devices/sdc
  native-path:                 /sys/devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/host10/target10:0:0/10:0:0:0/block/sdc
  device:                      8:32
  device-file:                 /dev/sdc
    by-id:                     /dev/disk/by-id/usb-B-EMB_USB_RAM_Disk_INST_0-0:0
    by-path:                   /dev/disk/by-path/pci-0000:00:1d.1-usb-0:1:1.0-scsi-0:0:0:0
  detected at:                 Fri 15 Jan 2010 07:25:24 AM PST
  system internal:             0
  removable:                   1
  has media:                   1 (detected at Fri 15 Jan 2010 07:25:24 AM PST)
    detects change:            1
    detection by polling:      1
    detection inhibitable:     1
    detection inhibited:       0
  is read only:                0
  is mounted:                  0
  mount paths:             
  mounted by uid:              0
  presentation hide:           0
  presentation nopolicy:       0
  presentation name:           
  presentation icon:           
  size:                        505856
  block size:                  512
  job underway:                no
  usage:                       
  type:                        
  version:                     
  uuid:                        
  label:                       
  partition table:
    scheme:                    mbr
    count:                     1
  drive:
    vendor:                    B-EMB
    model:                     USB RAM Disk
    revision:                  1.11
    serial:                    INST_0
    detachable:                1
    can spindown:              0
    rotational media:          1
    ejectable:                 0
    media:                     
      compat:                 
    interface:                 usb
    if speed:                  12000000 bits/s
    ATA SMART:                 not available

========================================================================
Showing information for /org/freedesktop/DeviceKit/Disks/devices/sdc1
  native-path:                 /sys/devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/host10/target10:0:0/10:0:0:0/block/sdc/sdc1
  device:                      8:33
  device-file:                 /dev/sdc1
    by-id:                     /dev/disk/by-id/usb-B-EMB_USB_RAM_Disk_INST_0-0:0-part1
    by-path:                   /dev/disk/by-path/pci-0000:00:1d.1-usb-0:1:1.0-scsi-0:0:0:0-part1
  detected at:                 Fri 15 Jan 2010 07:25:53 AM PST
  system internal:             0
  removable:                   0
  has media:                   1 (detected at Fri 15 Jan 2010 07:25:53 AM PST)
    detects change:            0
    detection by polling:      0
    detection inhibitable:     0
    detection inhibited:       0
  is read only:                0
  is mounted:                  0
  mount paths:             
  mounted by uid:              0
  presentation hide:           0
  presentation nopolicy:       0
  presentation name:           
  presentation icon:           
  size:                        489472
  block size:                  512
  job underway:                no
  usage:                       filesystem
  type:                        vfat
  version:                     FAT12
  uuid:                        
  label:                       
  partition:
    part of:                   /org/freedesktop/DeviceKit/Disks/devices/sdc
    scheme:                    mbr
    number:                    1
    type:                      0x01
    flags:                 boot
    offset:                    16384
    size:                      505344
    label:                     
    uuid:                      

========================================================================
Showing information for /org/freedesktop/DeviceKit/Disks/devices/sdd
  native-path:                 /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4:1.0/host8/target8:0:0/8:0:0:0/block/sdd
  device:                      8:48
  device-file:                 /dev/sdd
    by-id:                     /dev/disk/by-id/usb-Generic_USB_Flash_Disk_00000000000B13-0:0
    by-id:                     /dev/disk/by-uuid/2926-0CAA
    by-path:                   /dev/disk/by-path/pci-0000:00:1d.7-usb-0:4:1.0-scsi-0:0:0:0
  detected at:                 Thu 14 Jan 2010 03:43:37 PM PST
  system internal:             0
  removable:                   1
  has media:                   1 (detected at Thu 14 Jan 2010 03:43:37 PM PST)
    detects change:            1
    detection by polling:      1
    detection inhibitable:     1
    detection inhibited:       0
  is read only:                0
  is mounted:                  1
  mount paths:             /media/2926-0CAA
  mounted by uid:              501
  presentation hide:           0
  presentation nopolicy:       0
  presentation name:           
  presentation icon:           
  size:                        2021654528
  block size:                  512
  job underway:                no
  usage:                       filesystem
  type:                        vfat
  version:                     FAT16
  uuid:                        2926-0CAA
  label:                       
  drive:
    vendor:                    Generic
    model:                     USB Flash Disk
    revision:                  0.00
    serial:                    00000000000B13
    detachable:                1
    can spindown:              0
    rotational media:          1
    ejectable:                 0
    media:                     
      compat:                 
    interface:                 usb
    if speed:                  480000000 bits/s
    ATA SMART:                 not available

========================================================================
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux