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 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 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

  1. Become superuser or a console user.

  2. Connect the USB mass storage device.

  3. Verify that the USB device has been added.

    For example:

    $ rmformat
     Looking for devices...
           1. Logical Node: /dev/rdsk/c3t0d0p0
              Physical Node: /pci@0,0/pci108e,534a@2,1/storage@3/disk@0,0
              Connected Device: SanDisk  Cruzer Micro     0.3
              Device Type: Removable
              Bus: USB
              Size: 245.0 MB
              Label: <None>
              Access permissions: Medium is not write protected.
  4. Verify that the device is automatically mounted under the /media directory.

    For example:

    $ ls /media/NONAME
    aa  bb

    You can also use the rmmount -l command to list the paths and nicknames of mountable devices. If the device has been mounted under the /media directory, you will see output similar to the following:

    $ rmmount -l
    /dev/dsk/c3t0d0p0:1  rmdisk0,NONAME,/media/NONAME

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]    OLYMPUS, C-3040ZOOM,
    Jul 15 09:53:35 buffy genunix: [ID 936769] scsa2usb1 is 
    Jul 15 09:53:36 buffy scsi: [ID 193665] 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 30  2004 c3t0d0p0 ->
  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 19, 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

  1. Become superuser or a console user.

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

  3. Unmount the device.

    $ rmumount NONAME

    Or, use the umount command as superuser. For example:

    # umount /media/NONAME

    For more information about unmounting a USB device, see How to Mount or Unmount a USB Mass Storage Device.

  4. Remove the device.