# /dev/sda1 or uba1 only appears with "fdisk -l" ..n

## vdboor

I have a new usb flash device, but it has some weird behavour.

- I get all kinds of errors in dmesg when the device is plugged in.

- /dev/sda1 doesn't show up unless I use "fdisk -l" or "touch" on /dev/sda.  Same happens with /dev/sda1.

(a /etc/hotplug.d/block/usb.hotplug script didn't work, because it was called too early before /dev/uba existed).

- I don't know how I deal with the dynamic partitions and names of usb-disks.

Does anyone have some idea's for this?

Thanks in advice.

dmesg with "ub" driver:

```
usb 4-3: new high speed USB device using address 3

ub: sizeof ub_scsi_cmd 60 ub_dev 924

uba: device 3 capacity nsec 50 bsize 512

uba: made changed

uba: device 3 capacity nsec 50 bsize 512

uba: device 3 capacity nsec 50 bsize 512

 uba:end_request: I/O error, dev uba, sector 0

Buffer I/O error on device uba, logical block 0

end_request: I/O error, dev uba, sector 2

Buffer I/O error on device uba, logical block 1

end_request: I/O error, dev uba, sector 4

Buffer I/O error on device uba, logical block 2

end_request: I/O error, dev uba, sector 6

Buffer I/O error on device uba, logical block 3

end_request: I/O error, dev uba, sector 6

Buffer I/O error on device uba, logical block 3

end_request: I/O error, dev uba, sector 4

Buffer I/O error on device uba, logical block 2

end_request: I/O error, dev uba, sector 2

Buffer I/O error on device uba, logical block 1

end_request: I/O error, dev uba, sector 0

Buffer I/O error on device uba, logical block 0

 unable to read partition table

 uba:end_request: I/O error, dev uba, sector 2

Buffer I/O error on device uba, logical block 1

end_request: I/O error, dev uba, sector 4

Buffer I/O error on device uba, logical block 2

end_request: I/O error, dev uba, sector 6

Buffer I/O error on device uba, logical block 3

end_request: I/O error, dev uba, sector 0

Buffer I/O error on device uba, logical block 0

 unable to read partition table

usbcore: registered new driver ub
```

 (note the "unable to read partition table line..!)

dmesg with usb-storage driver:

```
usb 4-6: new high speed USB device using address 3

SCSI subsystem initialized

Initializing USB Mass Storage driver...

scsi0 : SCSI emulation for USB Mass Storage devices

  Vendor: USB 2.0   Model: Flash Disk        Rev: 2.00

  Type:   Direct-Access                      ANSI SCSI revision: 02

USB Mass Storage device found at 3

usbcore: registered new driver usb-storage

USB Mass Storage support registered.

sda: Unit Not Ready, sense:

Current : sense = 70  6

ASC=28 ASCQ= 0

Raw sense data:0x70 0x00 0x06 0x00 0x00 0x00 0x00 0x0a 0x00 0x00 0x00 0x00 0x28 0x00 0x00 0x00 0x00 0x00

sda : READ CAPACITY failed.

sda : status=1, message=00, host=0, driver=08

Current sd: sense = 70  6

ASC=28 ASCQ= 0

Raw sense data:0x70 0x00 0x06 0x00 0x00 0x00 0x00 0x0a 0x00 0x00 0x00 0x00 0x28 0x00 0x00 0x00 0x00 0x00

sda: assuming Write Enabled

sda: assuming drive cache: write through

sda: Unit Not Ready, sense:

Current : sense = 70  6

ASC=28 ASCQ= 0

Raw sense data:0x70 0x00 0x06 0x00 0x00 0x00 0x00 0x0a 0x00 0x00 0x00 0x00 0x28 0x00 0x00 0x00 0x00 0x00

sda : READ CAPACITY failed.

sda : status=1, message=00, host=0, driver=08

Current sd: sense = 70  6

ASC=28 ASCQ= 0

Raw sense data:0x70 0x00 0x06 0x00 0x00 0x00 0x00 0x0a 0x00 0x00 0x00 0x00 0x28 0x00 0x00 0x00 0x00 0x00

sda: assuming Write Enabled

sda: assuming drive cache: write through

sda: Unit Not Ready, sense:

Current : sense = 70  6

ASC=28 ASCQ= 0

Raw sense data:0x70 0x00 0x06 0x00 0x00 0x00 0x00 0x0a 0x00 0x00 0x00 0x00 0x28 0x00 0x00 0x00 0x00 0x00

sda : READ CAPACITY failed.

sda : status=1, message=00, host=0, driver=08

Current sd: sense = 70  6

ASC=28 ASCQ= 0

Raw sense data:0x70 0x00 0x06 0x00 0x00 0x00 0x00 0x0a 0x00 0x00 0x00 0x00 0x28 0x00 0x00 0x00 0x00 0x00

sda: assuming Write Enabled

sda: assuming drive cache: write through

 sda:end_request: I/O error, dev sda, sector 0

Buffer I/O error on device sda, logical block 0

Buffer I/O error on device sda, logical block 0

 unable to read partition table

 sda:<3>Buffer I/O error on device sda, logical block 0

 unable to read partition table

Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
```

running fdisk -l /dev/uba for ub driver (touch /dev/uba also works):

```
uba: is changed

uba: device 11 capacity nsec 512000 bsize 512

uba: device 11 capacity nsec 512000 bsize 512

 uba: uba1

uba: was not changed
```

running fdisk -l /dev/sda for usb-storage driver (touch also works):

```
SCSI device sda: 512000 512-byte hdwr sectors (262 MB)

sda: assuming Write Enabled

sda: assuming drive cache: write through

SCSI device sda: 512000 512-byte hdwr sectors (262 MB)

sda: assuming Write Enabled

sda: assuming drive cache: write through

 sda: sda1
```

lsusb:

```
Bus 004 Device 011: ID 0ea0:2168 Ours Technology, Inc.
```

----------

## vdboor

bump. anyone?

----------

## vdboor

I've been able to solve this manner with a very ugly HACK. You can use it if you have the same problems, but please try to find a better way to solve this:

Create /etc/hotplug.d/block/usb-read-partitions.hotplug:

```
#!/bin/sh

if [ "$ACTION" = "add" ] && echo "$DEVPATH" | grep -q '^/block/sd\|ub[a-z]$'; then

        (sleep 1; fdisk -l > /dev/null) &

        disown -a

fi
```

Save it, and use "chmod +x" to activate it.

update: I've been able to solve my I/O problems too; I've re-created the partition with cfdisk. (Too the "native partition support" of the kernel didn't help...)

----------

## Cintra

 *vdboor wrote:*   

> I've been able to solve this manner with a very ugly HACK. You can use it if you have the same problems, but please try to find a better way to solve this:
> 
> Create /etc/hotplug.d/block/usb-read-partitions.hotplug:
> 
> ```
> ...

 

Hei vdboor.. 

I've been searching around for the reason why my 64MB stick comes up as sda1 while my new Kingston Hi-speed DataTraveler Elite 1GB comes up as uba1.. so your post was very interesting. Hopefully someone can supply the answer. 

My goal is to use the latter as a bootable USB device, tho' I'm afraid it might not be possible ref a post at Flash Linux..

I notice also that the 64MB device shows up in kde's info center > scsi while the the 1GB device doesnt! The following is the only info available on it in 'messages' after booting.

```
Jan 11 06:21:37 p4pe ohci_hcd: 2004 Nov 08 USB 1.1 'Open' Host Controller (OHCI) Driver (PCI)

Jan 11 06:21:37 p4pe ohci_hcd: block sizes: ed 64 td 64

Jan 11 06:21:37 p4pe uhci_hcd 0000:00:1d.0: suspend_hc

Jan 11 06:21:37 p4pe ub: sizeof ub_scsi_cmd 64 ub_dev 2472

Jan 11 06:21:37 p4pe ub 1-2:1.0: usb_probe_interface

Jan 11 06:21:37 p4pe ub 1-2:1.0: usb_probe_interface - got id

Jan 11 06:21:37 p4pe uba: device 2 capacity nsec 2052607 bsize 512

Jan 11 06:21:37 p4pe uba: device 2 capacity nsec 2052607 bsize 512

Jan 11 06:21:37 p4pe uba: uba1

Jan 11 06:21:37 p4pe usbcore: registered new driver ub
```

 while removing & reinserting the key gives a bit more:

```
Jan 13 15:42:38 p4pe hub 1-0:1.0: state 5 ports 6 chg ffc0 evt 0004

Jan 13 15:42:38 p4pe ehci_hcd 0000:00:1d.7: GetStatus port 2 status 001002 POWER sig=se0  CSC

Jan 13 15:42:38 p4pe hub 1-0:1.0: port 2, status 0100, change 0001, 12 Mb/s

Jan 13 15:42:38 p4pe usb 1-2: USB disconnect, address 2

Jan 13 15:42:38 p4pe usb 1-2: usb_disable_device nuking all URBs

Jan 13 15:42:38 p4pe usb 1-2: unregistering interface 1-2:1.0

Jan 13 15:42:38 p4pe usb 1-2:1.0: hotplug

Jan 13 15:42:38 p4pe usb 1-2: unregistering device

Jan 13 15:42:38 p4pe usb 1-2: hotplug

Jan 13 15:42:38 p4pe udev[32538]: removing device node '/dev/uba1'

Jan 13 15:42:38 p4pe udev[32545]: removing device node '/dev/uba'

Jan 13 15:42:38 p4pe hub 1-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x100

Jan 13 15:42:39 p4pe hub 1-0:1.0: state 5 ports 6 chg ffc0 evt 0004

Jan 13 15:42:39 p4pe ehci_hcd 0000:00:1d.7: GetStatus port 2 status 001803 POWER sig=j  CSC CONNECT

Jan 13 15:42:39 p4pe hub 1-0:1.0: port 2, status 0501, change 0001, 480 Mb/s

Jan 13 15:42:39 p4pe hub 1-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x501

Jan 13 15:42:39 p4pe ehci_hcd 0000:00:1d.7: port 2 high speed

Jan 13 15:42:39 p4pe ehci_hcd 0000:00:1d.7: GetStatus port 2 status 001005 POWER sig=se0  PE CONNECT

Jan 13 15:42:39 p4pe usb 1-2: new high speed USB device using ehci_hcd and address 5

Jan 13 15:42:39 p4pe ehci_hcd 0000:00:1d.7: port 2 high speed

Jan 13 15:42:39 p4pe ehci_hcd 0000:00:1d.7: GetStatus port 2 status 001005 POWER sig=se0  PE CONNECT

Jan 13 15:42:39 p4pe usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=3

Jan 13 15:42:39 p4pe usb 1-2: default language 0x0409

Jan 13 15:42:39 p4pe usb 1-2: Product: DT Elite HS 2.0

Jan 13 15:42:39 p4pe usb 1-2: Manufacturer: Kingston

Jan 13 15:42:39 p4pe usb 1-2: SerialNumber: 09312B40C3121C29

Jan 13 15:42:39 p4pe usb 1-2: hotplug

Jan 13 15:42:39 p4pe usb 1-2: adding 1-2:1.0 (config #1, interface 0)

Jan 13 15:42:39 p4pe usb 1-2:1.0: hotplug

Jan 13 15:42:39 p4pe ub 1-2:1.0: usb_probe_interface

Jan 13 15:42:39 p4pe ub 1-2:1.0: usb_probe_interface - got id

Jan 13 15:42:39 p4pe uba: device 5 capacity nsec 0 bsize 512

Jan 13 15:42:39 p4pe udev[32611]: creating device node '/dev/uba'
```

I should add that the latter does work OK. I'm really after the answer to 'sda1 vs uba1' - why?

regards

----------

## vdboor

 *Cintra wrote:*   

> I've been searching around for the reason why my 64MB stick comes up as sda1 while my new Kingston Hi-speed DataTraveler Elite 1GB comes up as uba1.. so your post was very interesting. Hopefully someone can supply the answer. 

 

It's because you've compiled enabled the "Low Performance USB Block driver" option in the kernel setup. It can be found under block devices as of kernel 2.6.9.

What what I've read, it's supposed to replace the usb-storage/scsi-emulation stuff in the future. I think that's the good part  :Smile:  (sad part is the fact we run in all these troubles because we're kind-of playing our own distributer here..)

----------

## Cintra

You mean if I disable the Low Performance USB Block driver option the Kingston might/should come up as an sda device too?

I'm pretty sure that in my flurry of re-compiling the day before yesterday I tried this, but I will have another look.. 

I just discovered that the kernel's MTD section has very much to do with M-Systems diskonchip devices so I'm about to see what enabling some of those options will do...  :Wink: 

regards

----------

## Mord

I can't believe you haven't been told to just use udev yet.  Thats what I was told.  Remember, its not a bug, it was a design choice.

----------

## vdboor

 *Cintra wrote:*   

> You mean if I disable the Low Performance USB Block driver option the Kingston might/should come up as an sda device too?

 

Yes, that's what I've found at google about this new device-node. Eventually all USB devices are supposed to use /dev/ub*. The "ub" module is still in development now.

edit: if you compile the "ub" module, it takes over some functionality the usb-storage driver would be used for otherwise. (I think this describes the reason better)

----------

## Cintra

 *Mord wrote:*   

> I can't believe you haven't been told to just use udev yet.  Thats what I was told.  Remember, its not a bug, it was a design choice.

 

Hei Mord

Not quite sure what you mean? I am btw using udev on development-sources-2.6.11-rc1

mvh

----------

## Mord

I'm not using udev and I have to touch /dev/sda to re-use my usb storage devices.  I was told udev was the solution this problem.  Interesting.

----------

## Cintra

 *Mord wrote:*   

> I'm not using udev and I have to touch /dev/sda to re-use my usb storage devices.  I was told udev was the solution this problem.  Interesting.

 

It probably is.. 

I think the problem I'm seeing just applies to disk-on-a-stick type devices, and I have a bad feeling the Kingston is too 'windows designed'.

mvh

----------

## vdboor

 *Mord wrote:*   

> I'm not using udev and I have to touch /dev/sda to re-use my usb storage devices.  I was told udev was the solution this problem.  Interesting.

 

My fdisk -l thing does about the same thing as the touch... (only through hotplug, and it supplorts different device names, like sdb or uba) I had the same problem with my USB Device, but I didn't have this problem before. (2.6.9 problem or because it was a different device..?)

----------

## Cintra

fdisk -l /dev/uba is useful with the Kingston which becomes unmountable after removal & reinsertion, until I do  fdisk -l /dev/uba. Then it will mount..

mvh

----------

## Cintra

Hei vdboor

You were right about the Low Performance USB Block driver option!

I disabled this and USB_STORAGE_RW_DETECT, and now the Kingston 1GB device comes up as sda1, and the 64MB as sdb1 

At last!  :Very Happy: 

----------

## vdboor

 *Cintra wrote:*   

> fdisk -l /dev/uba is useful with the Kingston which becomes unmountable after removal & reinsertion, until I do  fdisk -l /dev/uba. Then it will mount..
> 
> mvh

 

Great.

BTE: you can also use fdisk without a device-node. that's the reason I used fdisk instead of touch  :Wink: 

----------

## oanjao

I recently got my A-DATA pen drive working, but I got very confused in the process because of old and semi-old information floating around out there.  This thread contains a lot of the pieces that explain the puzzle, but I am going to summarize in this one post all of the confusing bits.

If you are using the "Low Performance USB Block driver" kernel option like me, you will NOT get the usual kernel messages about SCSI this and that.  Instead, when you plug in the pen drive, you will see this:

```
Jan 19 14:27:59 athlon1700 usb 1-4: new high speed USB device using address 2

Jan 19 14:28:00 athlon1700 ub: sizeof ub_scsi_cmd 60 ub_dev 924

Jan 19 14:28:00 athlon1700 uba: device 2 capacity nsec 1024000 bsize 512

Jan 19 14:28:00 athlon1700 uba: was not changed

Jan 19 14:28:00 athlon1700 uba: uba1

Jan 19 14:28:00 athlon1700 usbcore: registered new driver ub

```

You will not be using most of the usb modules that you hear people talking about.  On my system, I get the following:

```
lsmod                   

Module                  Size  Used by

ub                     14364  0 

sd_mod                 11920  0 

scsi_mod               69760  1 sd_mod

vfat                   11840  0 

 ----- Additional output truncated -----

```

I am not sure that the ub module is even using the scsi modules, or if they are loaded because of something else in my system.

To see if your pen drive is in fact being recognized, look for it with

```
more /proc/bus/usb/devices
```

And look for a section like this:

```

T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#=  5 Spd=480 MxCh= 0

D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=0457 ProdID=0150 Rev= 1.00

S:  Manufacturer=USBest Technology

S:  Product=USB Mass Storage Device

S:  SerialNumber=000000000000AE

C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr= 80mA

I:  If#= 0 Alt= 0 #EPs= 3 Cls=08(stor.) Sub=06 Prot=50 Driver=ub

E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=125us

E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=16ms

```

When the pen drive is recognized, nothing tells you (that I can see) where its device node can be found.  If you get the output shown above, the drive can be accessed in someplace similar to /dev/uba1 or /dev/ubb1 and can be mounted with

```
mount -t vfat /dev/uba1 /mnt/pendrive/
```

(assuming that the pen drive is in fact formatted with VFAT)

I hope this helps somebody else in my situation.

----------

