9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] usb flash drive with ext2
@ 2012-01-11  9:45 Rudolf Sykora
  2012-01-11 10:06 ` Richard Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Rudolf Sykora @ 2012-01-11  9:45 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

I have a usb flash drive.

[ When plugged into my linux, /var/log/messages gives:

Jan 11 10:28:14 redstar kernel: [  388.588091] usb 1-3: new high speed
USB device using ehci_hcd and address 3
Jan 11 10:28:14 redstar kernel: [  388.743813] usb 1-3: New USB device
found, idVendor=058f, idProduct=6387
Jan 11 10:28:14 redstar kernel: [  388.743826] usb 1-3: New USB device
strings: Mfr=1, Product=2, SerialNumber=3
Jan 11 10:28:14 redstar kernel: [  388.743837] usb 1-3: Product: Mass Storage
Jan 11 10:28:14 redstar kernel: [  388.743844] usb 1-3: Manufacturer: Generic
Jan 11 10:28:14 redstar kernel: [  388.743851] usb 1-3: SerialNumber: ABC01089
Jan 11 10:28:14 redstar kernel: [  388.746708] scsi4 : usb-storage 1-3:1.0
Jan 11 10:28:15 redstar kernel: [  389.749192] scsi 4:0:0:0:
Direct-Access     Generic  Flash Disk       8.07 PQ: 0 ANSI: 2
Jan 11 10:28:15 redstar kernel: [  389.753494] sd 4:0:0:0: Attached
scsi generic sg2 type 0
Jan 11 10:28:15 redstar kernel: [  389.754612] sd 4:0:0:0: [sdb]
8007680 512-byte logical blocks: (4.09 GB/3.81 GiB)
Jan 11 10:28:15 redstar kernel: [  389.755405] sd 4:0:0:0: [sdb] Write
Protect is off
Jan 11 10:28:15 redstar kernel: [  390.388661]  sdb: unknown partition table
Jan 11 10:28:15 redstar kernel: [  390.391887] sd 4:0:0:0: [sdb]
Attached SCSI removable disk
]

It has an ext2 filesystem on itself and can be, in linux, mounted:
mount /dev/sdb mnt
without errors, and works.

What should I do to be able to work with the drive (read/write) in plan9?
(When I plug it into my plan9 machine, I don't see any entry like
/dev/sdUXX, I see 3 entries under /dev/usb/, ep4.0, ep4.1 and ep4.2,
which appear/disappear as I plug/unplug the device. Running usb/disk
claims sth. like 'there is no disk unhandled').

Thank you for suggestions!
Ruda



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] usb flash drive with ext2
  2012-01-11  9:45 [9fans] usb flash drive with ext2 Rudolf Sykora
@ 2012-01-11 10:06 ` Richard Miller
  2012-01-11 10:15   ` Rudolf Sykora
  2012-01-12  9:44   ` Rudolf Sykora
  0 siblings, 2 replies; 11+ messages in thread
From: Richard Miller @ 2012-01-11 10:06 UTC (permalink / raw)
  To: 9fans

> (When I plug it into my plan9 machine, I don't see any entry like
> /dev/sdUXX, I see 3 entries under /dev/usb/, ep4.0, ep4.1 and ep4.2,
> which appear/disappear as I plug/unplug the device. Running usb/disk
> claims sth. like 'there is no disk unhandled').

It appears you have no partition table and an ext2 fs occupying
the whole device.  This should be OK.

Try 'mount -a /srv/usb /dev' and see if /dev/sdUx.y appears.
If yes, try 'ext2srv -f /dev/sdUx.y/data && mount /srv/ext2 /n/linux'
If no, try 'cat /dev/usb/ep4.0/ctl' and see if you get something like:

	enabled control rw speed high maxpkt 64 pollival 0 samplesz 0 hz 0 hub 5 port 6 busy
	storage csp 0x500608 vid 0x058f did 0x6387 Generic 'Mass Storage' ehci

where "storage" means it's been recognised as a mass storage device,
and "busy" means it's already being handled by the usb/disk driver.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] usb flash drive with ext2
  2012-01-11 10:06 ` Richard Miller
@ 2012-01-11 10:15   ` Rudolf Sykora
  2012-01-12  9:44   ` Rudolf Sykora
  1 sibling, 0 replies; 11+ messages in thread
From: Rudolf Sykora @ 2012-01-11 10:15 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On 11 January 2012 11:06, Richard Miller <9fans@hamnavoe.com> wrote:
> It appears you have no partition table and an ext2 fs occupying
> the whole device.  This should be OK.

Yes, I think the ext2 is really occupying the whole device. This is in
accord with what linux has said.

> Try 'mount -a /srv/usb /dev' and see if /dev/sdUx.y appears.

I will when I back home.

> If yes, try 'ext2srv -f /dev/sdUx.y/data && mount /srv/ext2 /n/linux'
> If no, try 'cat /dev/usb/ep4.0/ctl' and see if you get something like:
>
>        enabled control rw speed high maxpkt 64 pollival 0 samplesz 0 hz 0 hub 5 port 6 busy
>        storage csp 0x500608 vid 0x058f did 0x6387 Generic 'Mass Storage' ehci
>
> where "storage" means it's been recognised as a mass storage device,
> and "busy" means it's already being handled by the usb/disk driver.

This I tried yesterday (cat /dev/usb/ep4.0/ctl), and I saw both 'busy'
and 'storage'.

So perhaps 'mount -a /srv/usb /dev' will help.
Thanks!
Ruda



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] usb flash drive with ext2
  2012-01-11 10:06 ` Richard Miller
  2012-01-11 10:15   ` Rudolf Sykora
@ 2012-01-12  9:44   ` Rudolf Sykora
  2012-01-12 10:07     ` Richard Miller
  1 sibling, 1 reply; 11+ messages in thread
From: Rudolf Sykora @ 2012-01-12  9:44 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On 11 January 2012 11:06, Richard Miller <9fans@hamnavoe.com> wrote:
> Try 'mount -a /srv/usb /dev' and see if /dev/sdUx.y appears.
> If yes, try 'ext2srv -f /dev/sdUx.y/data && mount /srv/ext2 /n/linux'
> If no, try 'cat /dev/usb/ep4.0/ctl' and see if you get something like:

1) Even though I plug in the usb stick, I have to manually run
'usb/disk' so that /dev/usb appears.
2) After 'mount -a /srv/usb /dev' /dev/sdU0.0 appears.
3) 'ext2srv -f /dev/sdU0.0/data && mount /srv/ext2 /n/linux' goes smoothly.
However.
; cd /n/linux
; lc
ls: .: I/O error

Any more help?

Thanks!
Ruda


PS.: 'cat /dev/usb/ep4.0/ctl' gives:
enabled control rw speed full maxpkt 64 pollival 0 samplesz 0 hz 0 hub
1 port 2 busy
storage csp 0x500608 vid 0x058f did 0x6387 Generic 'Mass Storage' uhci



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] usb flash drive with ext2
  2012-01-12  9:44   ` Rudolf Sykora
@ 2012-01-12 10:07     ` Richard Miller
  2012-01-12 10:21       ` Rudolf Sykora
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Miller @ 2012-01-12 10:07 UTC (permalink / raw)
  To: 9fans

> 3) 'ext2srv -f /dev/sdU0.0/data && mount /srv/ext2 /n/linux' goes smoothly.
> However.
> ; cd /n/linux
> ; lc
> ls: .: I/O error
>
> Any more help?

Try invoking ext2srv with '-v' to get more diagnostics.
Try 'dd -if /dev/sdU0.0/data -of /dev/null' to see if usb driver
is having trouble reading the device.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] usb flash drive with ext2
  2012-01-12 10:07     ` Richard Miller
@ 2012-01-12 10:21       ` Rudolf Sykora
  2012-01-12 10:26         ` Richard Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Rudolf Sykora @ 2012-01-12 10:21 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On 12 January 2012 11:07, Richard Miller <9fans@hamnavoe.com> wrote:
>> 3) 'ext2srv -f /dev/sdU0.0/data && mount /srv/ext2 /n/linux' goes smoothly.
>> However.
>> ; cd /n/linux
>> ; lc
>> ls: .: I/O error
>>
>> Any more help?
>
> Try invoking ext2srv with '-v' to get more diagnostics.

ext2srv 220: serving ext2
destroy(fid=302)
attach(fid=302,uname="ruda",aname="",afid="-1")...alloc
"/dev/sdU0.0/data", dev=3...good super block...OK

> Try 'dd -if /dev/sdU0.0/data -of /dev/null' to see if usb driver
> is having trouble reading the device.

0+1 records in
0+1 records out

The last bit is strange, isn't it?
Ruda



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] usb flash drive with ext2
  2012-01-12 10:21       ` Rudolf Sykora
@ 2012-01-12 10:26         ` Richard Miller
  2012-01-12 10:40           ` Rudolf Sykora
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Miller @ 2012-01-12 10:26 UTC (permalink / raw)
  To: 9fans

>> Try 'dd -if /dev/sdU0.0/data -of /dev/null' to see if usb driver
>> is having trouble reading the device.
>
> 0+1 records in
> 0+1 records out
>
> The last bit is strange, isn't it?

Try 'cat /dev/sdU0.0/ctl' to see if usb/disk has got the
geometry wrong.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] usb flash drive with ext2
  2012-01-12 10:26         ` Richard Miller
@ 2012-01-12 10:40           ` Rudolf Sykora
  2012-01-12 11:25             ` Richard Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Rudolf Sykora @ 2012-01-12 10:40 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On 12 January 2012 11:26, Richard Miller <9fans@hamnavoe.com> wrote:
>>> Try 'dd -if /dev/sdU0.0/data -of /dev/null' to see if usb driver
>>> is having trouble reading the device.
>>
>> 0+1 records in
>> 0+1 records out
>>
>> The last bit is strange, isn't it?
>
> Try 'cat /dev/sdU0.0/ctl' to see if usb/disk has got the
> geometry wrong.

/dev/usb/ep4.0 lun 0: inquiry Generic Flash Disk      8.07 geometry 8007680 512

linux' fdisk says:

Command (m for help): p

Disk /dev/sdb: 4099 MB, 4099932160 bytes
127 heads, 62 sectors/track, 1016 cylinders, total 8007680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xde308271

   Device Boot      Start         End      Blocks   Id  System

Command (m for help):

... so I'd think this is ok ...

Ruda



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] usb flash drive with ext2
  2012-01-12 10:40           ` Rudolf Sykora
@ 2012-01-12 11:25             ` Richard Miller
  2012-01-12 11:30               ` Francisco J Ballesteros
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Miller @ 2012-01-12 11:25 UTC (permalink / raw)
  To: 9fans

> /dev/usb/ep4.0 lun 0: inquiry Generic Flash Disk      8.07 geometry 8007680 512
>
> ... so I'd think this is ok ...

My next step would be to get more diagnostic output from usb/disk.
This is no longer easy with the new monolithic usb driver
architecture.  You can't just start 'usb/disk -d' because the usb/disk
embedded into usb/usbd will have started automatically and seized
control of the device when you plugged it in.

I think you will need to generate a new usbd with the disk driver
configured out (see /sys/src/cmd/usb/usbd/usbdb), then kill the usbd
which is embedded into the kernel and start your new one, before
running usb/disk.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] usb flash drive with ext2
  2012-01-12 11:25             ` Richard Miller
@ 2012-01-12 11:30               ` Francisco J Ballesteros
  2012-01-12 12:05                 ` Richard Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Francisco J Ballesteros @ 2012-01-12 11:30 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

you can enable debug diagnostics for devices by using the usbd ctl file.
I don´t remember which ones are the strings (see the man, probably) but
I remember you can enable debug flags without restarting it.

You could try to locate them and enable debug for that, plug the disk
again, disable
debug for that.

IIRC, that is.

On Thu, Jan 12, 2012 at 12:25 PM, Richard Miller <9fans@hamnavoe.com> wrote:
>> /dev/usb/ep4.0 lun 0: inquiry Generic Flash Disk      8.07 geometry 8007680 512
>>
>> ... so I'd think this is ok ...
>
> My next step would be to get more diagnostic output from usb/disk.
> This is no longer easy with the new monolithic usb driver
> architecture.  You can't just start 'usb/disk -d' because the usb/disk
> embedded into usb/usbd will have started automatically and seized
> control of the device when you plugged it in.
>
> I think you will need to generate a new usbd with the disk driver
> configured out (see /sys/src/cmd/usb/usbd/usbdb), then kill the usbd
> which is embedded into the kernel and start your new one, before
> running usb/disk.
>
>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] usb flash drive with ext2
  2012-01-12 11:30               ` Francisco J Ballesteros
@ 2012-01-12 12:05                 ` Richard Miller
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Miller @ 2012-01-12 12:05 UTC (permalink / raw)
  To: 9fans

> you can enable debug diagnostics for devices by using the usbd ctl file.

Sorry, I wasn't aware of that.  usbd(4) does describe setting
environment variables in plan9.ini to change the arguments for usb
drivers (I wasn't aware of that either), but doesn't mention that you
can also do it dynamically via usbdctl.  For example

  echo diskargs -d >/dev/usbdctl

before plugging in the device (or -dd, -ddd etc for more verbosity).
You may need to study the source of usb/disk to make sense of the
output.




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-01-12 12:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-11  9:45 [9fans] usb flash drive with ext2 Rudolf Sykora
2012-01-11 10:06 ` Richard Miller
2012-01-11 10:15   ` Rudolf Sykora
2012-01-12  9:44   ` Rudolf Sykora
2012-01-12 10:07     ` Richard Miller
2012-01-12 10:21       ` Rudolf Sykora
2012-01-12 10:26         ` Richard Miller
2012-01-12 10:40           ` Rudolf Sykora
2012-01-12 11:25             ` Richard Miller
2012-01-12 11:30               ` Francisco J Ballesteros
2012-01-12 12:05                 ` Richard Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).