Re: Sun Solaris USB Flash Drive mount command (scsa2usb driver)

From: Juergen Keil (jk_at_tools.de)
Date: 09/26/03


Date: 26 Sep 2003 20:44:12 +0200

unixasaurus@yahoo.com (Eunice Santorini) writes:

> x. Determine the SCSI channel the USB device is using:
> csh% ls -alrt /dev/rdsk | grep "pci@8,700000/usb@5,3/hub@3/storage@1"
> Which reported, in my test, controller c4, target t0, disk d0,
> slices s0 thru s7 with sub-slice ":a" thru ":h"
> (of which slice "s2" sub-slice ":c" appears to be most significant):
>
> lrwxrwxrwx 1 root root 65 Sep 23 15:24 c4t0d0s7 ->
> ../../devices/pci@8,700000/usb@5,3/hub@3/storage@1/disk@0,0:h,raw
>
> lrwxrwxrwx 1 root root 65 Sep 23 15:24 c4t0d0s6 ->
> ../../devices/pci@8,700000/usb@5,3/hub@3/storage@1/disk@0,0:g,raw
>
> lrwxrwxrwx 1 root root 65 Sep 23 15:24 c4t0d0s5 ->
> ../../devices/pci@8,700000/usb@5,3/hub@3/storage@1/disk@0,0:f,raw
>
> lrwxrwxrwx 1 root root 65 Sep 23 15:24 c4t0d0s4 ->
> ../../devices/pci@8,700000/usb@5,3/hub@3/storage@1/disk@0,0:e,raw
>
> lrwxrwxrwx 1 root root 65 Sep 23 15:24 c4t0d0s3 ->
> ../../devices/pci@8,700000/usb@5,3/hub@3/storage@1/disk@0,0:d,raw
>
> lrwxrwxrwx 1 root root 65 Sep 23 15:24 c4t0d0s2 ->
> ../../devices/pci@8,700000/usb@5,3/hub@3/storage@1/disk@0,0:c,raw
>
> lrwxrwxrwx 1 root root 65 Sep 23 15:24 c4t0d0s1 ->
> ../../devices/pci@8,700000/usb@5,3/hub@3/storage@1/disk@0,0:b,raw
>
> lrwxrwxrwx 1 root root 65 Sep 23 15:24 c4t0d0s0 ->
> ../../devices/pci@8,700000/usb@5,3/hub@3/storage@1/disk@0,0:a,raw
>
> Q: Which DEVICE is the one to mount?
> /dev/dsk/c4t0d0s7:h
> /dev/dsk/c4t0d0s6:g
> /dev/dsk/c4t0d0s5:f
> /dev/dsk/c4t0d0s4:e
> /dev/dsk/c4t0d0s3:d
> /dev/dsk/c4t0d0s2:c
> /dev/dsk/c4t0d0s1:b
> /dev/dsk/c4t0d0s0:a
> A: Presumably we mount c4t0d0s2:c or do we use c4t0d0s2:5 ???

It depends on the data stored on the device.

A standard SunOS disk label might exist on the device, with upto eight
different slices, and each slice might contain a different filesystem.
Similar to your HDD.

But these usb removable media devices often come from the
"DOS/Windows" world, so they don't contain SunOS disk labels. When a
valid SunOS disk label is missing, the SunOS disk driver creates a
"fake" slice table. It creates a slice table with slices "s0" and
"s2", and both can be used to access all of the data sectors contained
on the device.

Here's an example for an USB 256MB flash memory device. The command
"prtvtoc" prints the SunOS slice table for the device:

# prtvtoc /dev/rdsk/c4t0d0s2
* /dev/rdsk/c4t0d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 32 sectors/track
* 64 tracks/cylinder
* 2048 sectors/cylinder
* 0 cylinders
* 250 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
       0 0 00 0 512000 511999
       2 0 00 0 512000 511999

With this slice table, you can use the devices /dev/rdsk/c4t0d0s0
and /dev/rdsk/c4t0d0s2 to access the device. All other slices on
that device (s1, s3, ..., s7) cannot be used.

> ---------------------------------------------------------------------
> x. Double-check the selected device to mount:
>
> Q: What does this command actually tell us?
> A: ???
>
> csh% fdisk -W - /dev/rdsk/c4t0d0s2
> Which reported: fdisk: Cannot open device /dev/rdsk/c4t0d0s2.
> csh% fdisk -W - /dev/rdsk/c4t0d0s2:5
> Which reported: fdisk: Cannot stat device /dev/rdsk/c4t0d0s2:c.
> csh% fdisk -W - /dev/rdsk/c4t0d0s2:c
> Which reported: fdisk: Cannot stat device /dev/rdsk/c4t0d0s2:c.

The fdisk command probably cannot open the disk device because you're
not logged in as user "root".

The output from the fdisk command gives a hint if the media contains
a "DOS" FDISK partition table.

Using my usb 256MB flash memory device as an example:

# fdisk -W - /dev/rdsk/c4t0d0s2

* /dev/rdsk/c4t0d0s2 default fdisk table
* Dimensions:
* 512 bytes/sector
* 32 sectors/track
* 64 tracks/cylinder
* 250 cylinders
*
* systid:
...
* 6: DOSBIG

* Id Act Bhead Bsect Bcyl Ehead Esect Ecyl Rsect Numsect
  6 128 1 1 0 16 32 1000 32 511967

The important information is printed after the "* Id Act Bhead ...."
line. This USB device contains one FDISK partition entry, the partition
is type 6 (Id 6 == DOSBIG), the partition is marked "Active" (128),
it starts at sector 32 (Rsect) and contains 511967 (Numsect) sectors.

To mount the "BIGDOS" FAT filesystem from the FDISK partition starting
at sector 32, the mount command would be

    mount -F pcfs /dev/dsk/c4t0d0s2:c /mnt

If no data is printed following the "Id Act Bhead..." line, then
there's no valid DOS FDISK table on that media. In that case you
cannot use the ":c" logical drive suffix with the mount pcfs command.
But the media could still contain a DOS FAT filesystem, starting at
sector #0 of the device. To mount such a device, you would use the
command

    mount -F pcfs /dev/dsk/c4t0d0s2 /mnt



Relevant Pages