System Administration Guide: Devices and File Systems

Using USB Mass Storage Devices (Task Map)

Task 

Description 

For Instructions 

Prepare to use a USB mass storage device 

Prepare to use a USB mass storage device with vold running.

Preparing to Use a USB Mass Storage Device With vold Running

 

Prepare to use a USB mass storage device without vold running.

How to Prepare to Use USB Mass Storage Devices Without vold Running

Display USB device information 

Use the prtconf command to display information about USB devices.

How to Display USB Device Information (prtconf)

Format a USB mass storage device 

Format a USB mass storage device so that you can put data on it. 

How to Format a USB Mass Storage Device Without vold Running

Mount a USB mass storage device 

Mount a USB mass storage device with vold running.

How to Mount or Unmount a USB Mass Storage Device With vold Running

 

Mount a USB mass storage device without vold running.

How to Mount or Unmount a USB Mass Storage Device Without vold Running

(Optional) Disable USB device drivers 

Disable USB device drivers if you do not want the USB support on your system. 

 

(Optional) Remove unused USB device links 

Remove unused USB device links with the devfsadm command.

How to Remove Unused USB Device Links

Using USB Mass Storage Devices


Note –

For up-to-date information on using USB mass storage devices in this Solaris release, see USB Mass Storage Devices.


Starting in the Solaris 9 release, removable mass storage devices such as USB CD-RWs, hards disks, DVDs, digital cameras, Zip, Peerless, SmartMedia, CompactFlash, ORB, and USB diskette devices are supported.

For a complete list of USB devices that are supported in the Solaris environment, see http://www.sun.com/io_technologies/USB.html.

These devices can be managed with or without volume management. For information on managing devices with volume management, see vold(1M).

Using USB Diskette Devices

USB diskette devices appear as removable media devices like other USB devices. USB diskette devices are not managed by the fd (floppy) driver. Applications that issue ioctl(2) calls intended for the fd (native floppy) driver will fail. Applications that issue only read(2) and write(2) calls will succeed. Other applications, such as SunPCI and rmformat, will also succeed.


Note –

CDE's File Manager does not fully support USB diskettes at this time. However, you can open, rename, and format diskettes that contain a UFS file system from File Manager's Removable Media Manager. You can only open diskettes that contain a PCFS file system from the Removable Media Manager. If a diskette contains either type of file system, you can successfully drag and drop files between the diskette and File Manager.


Volume management (vold) sees the USB diskette device as a SCSI removable media device. Volume management makes the device available for access under the /rmdisk directory.

For more information on how to use USB diskette devices, see Chapter 1, Managing Removable Media (Overview).

Using Non-Compliant USB Mass Storage Devices

Some devices might be supported by the USB mass storage driver even though they do not identify themselves as compliant with the USB mass storage class or identify themselves incorrectly. The scsa2usb.conf file contains an attribute-override-list that lists the vendor ID, product ID, and revision for matching mass storage devices, as well as fields for overriding the default device attributes. The entries in this list are commented out by default, and can be copied and uncommented to enable support of particular devices.

If you connect a USB mass storage device to a system running this Solaris release and the system is unable to use it, you can check the /kernel/drv/scsa2usb.conf file to see if there is a matching, commented entry for this device. Follow the information given in the scsa2usb.conf file to see if a particular device can be supported by using the override information. For a listing of recommended USB mass storage devices, go to http://www.sun.com/io_technologies/USB.html.

For more information, see scsa2usb(7D).

Preparing to Use a USB Mass Storage Device With vold Running

If you are running the Solaris Common Desktop Environment (CDE), USB removable mass storage devices are managed by the Removable Media Manager component of the CDE File Manager. For more information on the CDE File Manager, see dtfile(1).


Note –

You must include the /usr/dt/man directory in your MANPATH variable to display the man pages that are listed in this section. You must also have the /usr/dt/bin directory in your path and have CDE running to use these commands, or have a DISPLAY variable set to use these commands remotely.


The following table identifies the commands that Removable Media Manager uses to manage storage devices from the CDE environment.

Command  

Man Page 

Task 

sdtmedia_format

sdtmedia_format(1)

Format and label a device 

sdtmedia_prop

sdtmedia_prop(1)

Display properties of a device 

sdtmedia_prot

sdtmedia_prot(1)

Change device protection 

sdtmedia_slice

sdtmedia_slice(1)

Create or modify slices on a device 

After the USB device is formatted, it is usually mounted under the /rmdisk/label directory. For more information on configuring removable storage devices, see rmmount.conf(4) or vold.conf(4).

The device nodes are created under the /vol/dev directory. For more information, see scsa2usb(7D).

The following procedures describe how to manage USB mass storage devices without vold running. The device nodes are created under the /dev/rdsk directory for character devices and under the /dev/dsk directory for block devices. Device links are created when the devices are hot-plugged. For more information, see scsa2usb(7D).

ProcedureHow to Prepare to Use USB Mass Storage Devices Without vold Running

You can use USB mass storage devices without the volume management (vold) running. Stop vold by issuing the following command:


# /etc/init.d/volmgt stop

Or, use the following procedure to keep vold running, but do not register the USB mass storage devices with vold.

Steps
  1. Become superuser.

  2. Remove volume manager registration of USB mass storage devices by commenting the following line in the /etc/vold.conf file, like this:


    # use rmdisk drive /dev/rdsk/c*s2 dev_rmdisk.so rmdisk%d
  3. After this line is commented, restart vold.


    # /etc/init.d/volmgt start 
    

    Caution – Caution –

    If you comment out this line and other SCSI or ATAPI Zip, Peerless or other removable devices are in the system, vold registration for these devices would be disabled as well.


    For more information, see vold.conf(4).

How to Display USB Device Information (prtconf)

Use the prtconf command to display information about USB devices.


$ prtconf
        usb, instance #0
                 hub, instance #2
                     device, instance #8
                         interface (driver not attached)
                     printer (driver not attached)
                     mouse, instance #14
                     device, instance #9
                         keyboard, instance #15
                         mouse, instance #16
                     storage, instance #7
                         disk (driver not attached)
                     communications, instance #10
                         modem (driver not attached)
                         data (driver not attached)
                 storage, instance #0
                     disk (driver not attached)
                 storage, instance #1
                     disk (driver not attached)

You can use the prtconf command's -D option to display additional driver information. This information can be used to tell which ports and devices are being driven by the USBA 1.0 framework on SPARC systems, as displayed in the following example:


$ prtconf -D
.
.
.
SUNW,Sun-Blade-1500
.
.
.
1 pci, instance #0 (driver name: pcisch) 
           isa, instance #0 (driver name: ebus)
.
.
.
2 usb, instance #0 (driver name: ohci)
           usb, instance #1 (driver name: ohci)
.
.
.
3 pci, instance #0 (driver name: pci_pci)
4 usb, instance #0 (driver name: usba10_ohci)
            usb, instance #1 (driver name: usba10_ohci)
            usb, instance #0 (driver name: usba10_ehci)
                storage, instance #9 (driver name: usba10_scsa2usb)
                    disk, instance #9 (driver name: usb_sd)
            firewire, instance #0 (driver name: hci1394)
.
.
.

In the output above, note the following configuration characteristics:

ProcedureHow to Format a USB Mass Storage Device Without vold Running

USB mass storage devices, as all others used by the Solaris operating system, must be formatted and contain a file system before they can be used. USB mass storage devices, including diskettes, support both PCFS and UFS file systems. Be sure the disk is formatted before putting either a PCFS or UFS file system on it.

Steps
  1. See How to Prepare to Use USB Mass Storage Devices Without vold Running for information on disabling vold.

  2. (Optional) Add the USB diskette device to your system.

    For information on hot-plugging USB devices, see:

  3. (Optional) Identify the diskette device.

    For example:


    # cd /dev/rdsk
    # devfsadm -C
    # ls -l c*0 | grep usb
    lrwxrwxrwx   1 root  root   55 Mar  5 10:35 c2t0d0s0 ->
    ../../devices/pci@1f,0/usb@c,3/storage@3/disk@0,0:a,raw

    In this example, the diskette device is c2t0d0s0.

  4. Insert a diskette into the diskette drive.

  5. Format the diskette.


    % rmformat -Flong raw-device
    

    For example:


    % rmformat -Flong /dev/rdsk/c2t0d0s0
    
  6. Determine the file system type and select one of the following:

    1. Create a PCFS file system.


      # mkfs -F pcfs -o nofdisk,size=size raw-device
      

      Specify the -size option in 512–byte blocks.

      The following example shows how to create a PCFS file system on a 1.4 Mbyte diskette.


      # mkfs -F pcfs -o nofdisk,size=2880 /dev/rdsk/c4t0d0s0
      

      The following example shows how to create a UFS file system on a 100 Mbyte Zip drive.


      # mkfs -F pcfs -o nofdisk,size=204800 /dev/rdsk/c5t0d0s0
      

      This command can take several minutes to complete.

    2. Create a UFS file system.


      # newfs raw-device
      

      For example:


      # newfs /dev/rdsk/c4t0d0s0
      

      Note –

      UFS file system overhead consumes a significant portion of space on a diskette, due to a diskette's limited storage capacity.


ProcedureHow to Mount or Unmount a USB Mass Storage Device With vold Running

Steps
  1. Display device aliases for all removable mass storage devices, including USB mass storage devices.


    $ eject -n
    .
    .
    .
    cdrom0 -> /vol/dev/rdsk/c0t6d0/audio_cd   (Generic CD device)
    zip0 -> /vol/dev/rdsk/c1t0d0/zip100       (USB Zip device)
    zip1 -> /vol/dev/rdsk/c2t0d0/fat32        (USB Zip device)
    rmdisk0 -> /vol/dev/rdsk/c5t0d0/unnamed_rmdisk (Peerless, HD or floppy)
    rmdisk1 -> /vol/dev/rdsk/c4t0d0/clik40    (Generic USB storage)
  2. Select one of the following to mount or unmount a USB mass storage device.

    1. Mount a USB mass storage device by using the device aliases listed previously.


      $ volrmmount -i device-alias
      

      This example shows how to mount a USB Zip drive (/rmdisk/zip0).


      $ volrmmount -i zip0 
      
    2. Unmount a USB mass storage device.


      $ volrmmount -e device-alias
      

      This example shows how to unmount a USB Zip drive (/rmdisk/zip0).


      $ volrmmount -e zip0
      
  3. Eject a USB device from a generic USB drive.


    $ eject device-alias
    

    For example:


    $ eject rmdisk0
    

    Note –

    The eject command also unmounts the device if the device is not unmounted already. The command also terminates any active applications that access the device.


ProcedureHow to Mount or Unmount a USB Mass Storage Device Without vold Running

Steps
  1. See How to Prepare to Use USB Mass Storage Devices Without vold Running for information on disabling vold.

  2. Become superuser.

  3. (Optional) Identify the diskette device.

    For example:


    # cd /dev/rdsk
    # devfsadm -C
    # ls -l c*0 | grep usb
    lrwxrwxrwx   1 root  root   55 Mar  5 10:35 c2t0d0s0 ->
    ../../devices/pci@1f,0/usb@c,3/storage@3/disk@0,0:a,raw

    In this example, the diskette device is c2t0d0s0.

  4. Select one of the following to mount or unmount a USB mass storage device.

    1. Mount a USB mass storage device.


      # mount [ -F fstype ] block-device mount-point
      

      This example shows how to mount a device with a UFS file system.


      # mount /dev/dsk/c1t0d0s2 /mnt
      

      This example shows how to mount a device with a PCFS file system.


      # mount -F pcfs /dev/dsk/c1t0d0s0:c /mnt
      

      This example shows how to mount a CD with a read-only HSFS file system.


      # mount -F hsfs -o ro /dev/dsk/c1t0d0s2 /mnt
      
    2. Unmount a USB mass storage device.

      First, be sure no one is using the file system on the device.

      For example:


      # fuser -c -u /mnt
      # umount /mnt
      
    3. Eject the device.


      # eject /dev/[r]dsk/cntndnsn
      

      For example:


      # eject /dev/rdsk/c1t0d0s2 
      

Disabling Specific USB Drivers

You can disable specific types of USB devices by disabling their client driver. For example, USB printers can be disabled by disabling the usbprn driver that directs them. Disabling usbprn does not affect other kinds of devices, such as USB storage devices.

Be careful that device types are disabled on both frameworks. You cannot disable device types on one framework only. The following table identifies some USB device types and their corresponding drivers.

Device Type 

Driver to Disable 

audio 

usb_ac and usb_as

HID (usually keyboard and mouse 

hid

storage 

scsa2usb

printer 

usbprn

serial 

usbser_edge

If you disable a driver for a USB device that is still connected to the system, you will see a console message similar to the following:


usba10: WARNING: usba:    no driver found for device name

ProcedureHow to Disable Specific USB Drivers

Steps
  1. Become superuser.

  2. Record the driver aliases that you are about to remove.


    # cp /etc/driver_aliases /etc/driver_aliases.orig
    
  3. Identify the specific USB driver alias name.

    For example:


    # grep usbprn /etc/driver_aliases
    usbprn "usbif,class7.1.1"
    usbprn "usbif,class7.1.2"
  4. Remove the driver alias entry.

    For example:


    # update_drv -d -i '"usbif,class7.1.1"' usbprn
    # update_drv -d -i '"usbif,class7.1.2"' usbprn
    
  5. Reboot the system.


    # init 6
    

ProcedureHow to Remove Unused USB Device Links

Use this procedure if a USB device is removed while the system is powered off. It is possible that removing the USB device while the system is powered off will leave device links for devices that do not exist.

Steps
  1. Become superuser.

  2. Close all applications that might be accessing the device.

  3. Remove the unused links for a specific USB class.

    For example:


    # devfsadm -C -c audio
    

    Or, just remove the dangling links:


    # devfsadm -C