System Administration Guide: Devices and File Systems

Hot-Plugging USB Mass Storage 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.

The removable media manager is now aware of hot-plugged devices. You can just plug in the device, which is mounted in a few seconds. If nothing happens, check to see if it is mounted.

Make sure that removable media services are running.


# svcs volfs
STATE          STIME    FMRI
online         10:39:12 svc:/system/filesystem/volfs:default

# svcs hal dbus rmvolmgr
STATE          STIME    FMRI
online         May_03   svc:/system/dbus:default
online         May_03   svc:/system/hal:default
online         May_03   svc:/system/filesystem/rmvolmgr:default

The file system can be mounted from the device if it is valid and it is recognized.

If it fails to mount, stop vold.


# svcadm disable volfs

If the file system on the device is not automatically mounted, try a manual mount.

Before hot-removing the device, find the name of the device in the eject -l command's alias name. Then eject the device's media. If you don't do this, the device is released and the port is usable again, but the file system on the device might have been damaged.

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 you are using the device.

If you are using a device 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 returns 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 becomes available again.


Note –

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


ProcedureHow to Add a USB Mass Storage Device Without vold Running

  1. For information on disabling removable media management, see How to Disable or Enable Removable Media Services.

  2. Verify that vold is not running.


    # svcs volfs
    STATE          STIME    FMRI
    disabled       10:39:12 svc:/system/filesystem/volfs:default
  3. Connect the USB mass storage device.

  4. Verify that the USB device has been added.

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


    $ rmformat
    Looking for devices...
    1. Logical Node: /dev/rdsk/c3t0d0p0
       Physical Node: /pci@0,0/pci108e,4131@2,1/storage@4/disk@0,0
       Connected Device: USB2.0   Flash Disk       2.00
       Device Type: Removable

ProcedureHow to Add a USB Camera

If the camera's media uses a PCFS file system, it will be automatically mounted. If the device does not bind to the scsa2usb driver, use libusb applications for transferring the pictures. For more information, refer to /usr/sfw/share/doc/libusb/libusb.txt.

  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 system treats the camera as a storage device.

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


    # more /var/adm/messages
    

    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 looks similar to the following:


    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

    Match the device with a mountable /dev/dsk link entry, by doing the following:


    # ls -l /dev/dsk/c*0 | grep /pci@0,0/pci925,1234@7,2/storage@2
     lrwxrwxrwx   1 root     root          58 Jun 14  2010 c3t0d0p0 ->
     ../../devices/pci@0,0/pci925,1234@7,2/storage@2/disk@0,0:a
  4. Mount the USB camera file system.

    The camera's file system is most likely a PCFS file system. If file system is PCFS, then it should be automatically mounted.

    To manually mount the file system on an x86 system, you would use syntax similar to the following:


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

    To manually mount the file system on a SPARC system, you would use syntax similar to the following:


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

    For information on mounting file systems, see Chapter 18, 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.

    For example:


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

    For example:


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

ProcedureHow to Remove a USB Mass Storage Device Without vold Running

This is procedure is performed with removable media services disabled.

  1. Become superuser.

  2. For information on disabling removable media services, see How to Disable or Enable Removable Media Services.

  3. Verify that removable media services are not running.


    # svcs volfs
    STATE          STIME    FMRI
    disabled       Sep_29   svc:/system/filesystem/volfs:default
  4. Stop any active applications that are using the device.

  5. Unmount the device.

  6. Remove the device.