System Administration Guide: Basic Administration

Hot-Plugging USB Devices

Hot-plugging a device means the device is added or removed without shutting down the operating system or powering off the system. All USB devices are hot-pluggable.

When you hot-plug a USB device, the device is immediately seen in the system's device hierarchy, as displayed in the prtconf command output. When you remove a USB device, the device is removed from the system's device hierarchy, unless the device is in use.

If the USB device is in use when it is removed, the hot-plug behavior is a little different. If a device is in use when it is unplugged, the device node remains, but the driver controlling this device stops all activity on the device. Any new I/O activity issued to this device is returned with an error.

In this situation, the system prompts you to plug in the original device. If the device is no longer available, stop the applications. After a few seconds, the port will become available again.


Note –

Data integrity might be impaired if you remove an active or open device. Always close the device before removing, except the console keyboard and mouse, which can be moved while active.


How to Add a USB Mass Storage Device With vold Running

This procedure describes how to add a USB device with vold running.

For more information on volume management device names, see Chapter 17, Managing Removable Media (Overview).

  1. Insert the USB mass storage device.

  2. Instruct vold to scan for new devices.


    # touch /etc/vold.conf
    
  3. Restart vold.


    # pkill -HUP vold
    
  4. Verify that the device has been added.


    $ ls device-alias
    

How to Add a USB Mass Storage Device Without vold Running

This procedure describes how to add a USB device without vold running.

  1. Add a USB device into the USB port.

  2. Verify that the USB device has been added.

    Locate the USB disk device links, which may be among device links of non-USB storage devices, as follows:


    $ cd /dev/rdsk
    $ ls -l c*0 | grep usb
    lrwxrwxrwx   1 root     root          67 Apr 30 15:12 c1t0d0s0 ->
    	../../devices/pci@1f,0/pci@5/pci@0/usb@8,2/storage@1/disk@0,0:a,raw

How to Remove a USB Mass Storage Device With vold Running

The following procedure uses a Zip drive as an example of removing a USB device with vold running.

  1. Unmount the device.


    $ volrmmount -e zip0
    
  2. Stop any active applications that are using the device.

  3. Unmount the device.


    $ volrmmount -e zip0
    
  4. Eject the device.


    $ eject zip0
    
  5. Become superuser and stop vold.


    # /etc/init.d/volmgt stop
    
  6. Remove the USB mass storage device.

  7. Start vold.


    # /etc/init.d/volmgt start
    

How to Remove a USB Mass Storage Device Without vold Running

This procedure describes how to remove a USB device without vold running.

  1. Become superuser.

  2. Stop any active applications that are using the device.

  3. Remove the USB device.

    1. Unmount the device.


      # umount /mount-point
      
    2. Remove the device.

Mounting USB Mass Storage Devices With or Without vold Running

If you are running Solaris Common Desktop Environment (CDE), the 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).

You can use USB mass storage devices without the volume manager (vold) running. Here are two ways to avoid using the volume manager.

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. For more information, see scsa2usb(7D).

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

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


    $ eject -n
    .
    .
    .
    rmdisk0 -> /vol/dev/rdsk/c4t0d0/clik40    (Generic USB storage)
    cdrom0 -> /vol/dev/rdsk/c0t6d0/audio_cd   (Generic CD device)
    zip1 -> /vol/dev/rdsk/c2t0d0/fat32        (USB Zip device)
    zip0 -> /vol/dev/rdsk/c1t0d0/zip100       (USB Zip device)
    jaz0 -> /vol/dev/rdsk/c3t0d0/jaz1gb       (USB Jaz device)
  2. 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 
    
  3. 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
    
  4. 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.


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

  1. Become superuser.

  2. Mount a USB mass storage device.


    # mount -F fs-type /dev/dsk/cntndnsn /mount-point
    

    This command might fail if the device is read-only. Use the following command for CD-ROM devices.


    # mount -F fs-type -o ro /dev/dsk/cntndnsn /mount-point
    

    For example:


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


    # umount /mount-point
    
  4. Eject the device.


    # eject /dev/[r]dsk/cntndnsn
    

How to Add a USB Camera

Use this procedure to add a USB camera.

  1. Become superuser.

  2. Plug in and turn on the USB camera.

    The system creates a logical device for the camera. After the camera is plugged in, output is written to the /var/adm/messages file to acknowledge the device's connection. The camera is seen as a storage device to the system.

  3. Examine the output that is written to the /var/adm/messages file.

    Examining this output enables you to determine which logical device was created so that you can then use that device to access your images. The output will look similar to the following:


    # more /var/adm/messages
    Jul 15 09:53:35 buffy usba: [ID 349649 kern.info]    OLYMPUS, C-3040ZOOM,
     000153719068
    Jul 15 09:53:35 buffy genunix: [ID 936769 kern.info] scsa2usb1 is 
    /pci@0,0/pci925,1234@7,2/storage@2
    Jul 15 09:53:36 buffy scsi: [ID 193665 kern.info] sd3 at scsa2usb1: 
    target 0 lun 0
  4. Mount the USB camera file system.

    The camera's file system is most likely a PCFS file system. In order to mount the file system on the device created, the slice that represents the disk must be specified. The slice is normally s0 for a SPARC system, and p0 for an x86 system.

    For example, to mount the file system on an x86 system, execute the following command:


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

    To mount the file system on a SPARC system, execute the following command:


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

    For information on mounting file systems, see Chapter 40, Mounting and Unmounting File Systems (Tasks).

    For information on mounting different PCFS file systems, see mount_pcfs(1M).

  5. Verify that the image files are available.

    For example:


    # ls /mnt/DCIM/100OLYMP/
    P7220001.JPG*  P7220003.JPG*  P7220005.JPG*
    P7220002.JPG*  P7220004.JPG*  P7220006.JPG*
  6. View and manipulate the image files created by the USB camera.


    # /usr/dt/bin/sdtimage P7220001.JPG &
    
  7. Unmount the file system before disconnecting the camera.

    For example:


    # umount /mnt
    
  8. Turn off and disconnect the camera.