系统管理指南:设备和文件系统

使用 USB 海量存储设备

从 Solaris 9 发行版开始,支持以下 USB 可移除海量存储设备:

有关将 USB 海量存储设备用于 Solaris ZFS 文件系统的信息,请参见Solaris 10 6/06 发行版在 USB 设备方面的新增功能

有关 Solaris OS 所支持的 USB 设备的完整列表,请参见:

http://www.sun.com/io_technologies/USB.html

在以前的 Solaris 发行版中,所有的 USB 存储设备都被标识为可移除介质设备,这些设备可提供以下许多优点,包括通过 vold 自动挂载。在 Solaris 10 6/06 发行版中,USB 海量存储设备被标识为可热插拔设备,而且具有 USB 可移除设备的优点(如下所述)。有关可热插拔行为的更多信息,请参见USB 和 1394 (FireWire) 支持增强功能

有关使用 USB 海量存储设备的更多信息,请参见 scsa2usb(7D)

使用 USB 软盘设备

USB 软盘设备显示为可移除介质设备。USB 软盘设备不是通过 fd(软盘)驱动程序进行管理的。发出旨在用于 fd(本机软盘)驱动程序的 ioctl(2) 调用的应用程序将失败。仅发出 read(2)write(2) 调用的应用程序将成功。其他应用程序(如 SunPCI 和 rmformat)也将成功。

卷管理 (vold) 会将 USB 软盘设备视为 SCSI 可移除介质设备。通过卷管理可在 /rmdisk 目录下访问该设备。

有关如何使用 USB 软盘设备的更多信息,请参见第 1 章,管理可移除介质(概述)

使用不兼容的 USB 海量存储设备

即使某些设备未将其自身标识为与 USB 海量存储类兼容,或以不正确的方式标识其自身, USB 海量存储驱动程序也仍可能支持这些设备。scsa2usb.conf 文件包含一个属性覆盖列表,其中列有供应商 ID、产品 ID、用于匹配海量存储设备的修订版,以及用于覆盖缺省设备属性的字段。缺省情况下,会注释掉此列表中的项。要启用对特定设备的支持,可以复制并取消注释这些项。

如果将 USB 海量存储设备连接至运行此 Solaris 发行版的系统,但该系统无法使用它,则可以检查 /kernel/drv/scsa2usb.conf 文件,查看是否存在与该设备对应的注释掉的项。根据 scsa2usb.conf 文件中给出的信息,查看是否可以使用覆盖信息支持特定设备。

有关推荐的 USB 海量存储设备的列表,请转至:

http://www.sun.com/io_technologies/USB.html

有关更多信息,请参见 scsa2usb(7D)

Procedure如何使用不兼容的 USB 海量存储设备

  1. 成为超级用户。

  2. /kernel/drv/scsa2usb.conf 文件中添加项。

    以下项适用于 USB 内存条。


    attribute-override-list = "vid=* reduced-cmd-support=true";
  3. 重新引导系统或执行以下操作:

    1. 手动更新驱动程序。


      # update_drv -f scsa2usb
      
    2. 移除该设备。

    3. 添加该设备。

热插拔 USB 海量存储设备

热插拔设备是指在未关闭操作系统或未关闭系统电源的情况下添加或移除设备。所有的 USB 设备都是可热插拔设备。

可移除介质管理器 (vold) 现在可以识别热插拔设备。一旦插入该设备,vold 便会在几秒钟内尝试对其进行挂载。如果未发生任何情况,请查看该设备是否已挂载。

确保 vold 正在运行。


# svcs volfs

STATE          STIME    FMRI

online         10:39:12 svc:/system/filesystem/volfs:default

如果文件系统有效并且可由 vold 进行识别,则可以从该设备将其挂载。

如果无法挂载,请停止 vold


# svcadm disable volfs

然后,尝试手动挂载。

热移除设备之前,应在 eject -n 命令的别名中找到该设备的名称。然后,弹出该设备的介质。如果不执行此操作,vold 仍会释放该设备,并且端口可再次使用,但是该设备中的文件系统可能已被破坏。

热插拔 USB 设备时,系统的设备分层结构中会立即显示该设备,如 prtconf 命令输出所示。移除 USB 设备时,如果未使用该设备,则会从系统的设备分层结构中删除该设备。

如果拔除设备时正在使用该设备,则该设备节点仍然存在,但控制该设备的驱动程序将停止该设备中的所有活动。向此设备发出的任何新的 I/O 活动都会返回错误。

在这种情况下,系统会提示插入原始设备。如果该设备不再可用,请停止应用程序。几秒钟后,端口将再次可用。


注 –

移除活动的设备或打开的设备可能会损害数据完整性。移除设备之前应始终先将其关闭,但连接的键盘和鼠标除外(可在活动状态时将其移除)。


以只读方式挂载 USB 海量存储设备

通过更改 /etc/rmmount.conf 文件中的以下行,可以采用只读方式挂载 USB 海量存储设备:


mount * hsfs udfs ufs -o nosuid

更改为:


mount * hsfs udfs ufs -o nosuid,ro

然后重新启动 vold


# svcadm disable volfs

# svcadm enable volfs

此时会以只读方式挂载包含这些文件系统的可移除设备。

Procedure如何在不运行 vold 的情况下添加 USB 海量存储设备

  1. (可选)有关禁用 vold 的信息,请参见如何在不运行 vold 的情况下准备使用 USB 海量存储设备

  2. 检验 vold 是否未运行。


    # svcs volfs
    
    STATE          STIME    FMRI
    
    disabled       10:39:12 svc:/system/filesystem/volfs:default
  3. 连接 USB 海量存储设备。

  4. 检验是否已添加 USB 设备。

    查找 USB 磁盘设备链路,这些链路可能在非 USB 存储设备的设备链路中,如下所示:


    $ 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

Procedure如何添加 USB 相机

如果相机的介质使用 PCFS 文件系统,则 vold 会自动挂载该相机。 如果该设备未绑定至 scsa2usb 驱动程序,请使用 libusb 应用程序来传送图片。有关更多信息,请参阅 /usr/sfw/share/doc/libusb/libusb.txt

  1. 成为超级用户。

  2. 插入并打开 USB 相机。

    系统将为相机创建一个逻辑设备。插入相机后,会将输出写入 /var/adm/messages 文件,以确认设备的连接。系统会将相机视为存储设备。

  3. 检查写入 /var/adm/messages 文件的输出。


    # 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

    请通过执行以下操作,使该设备与可挂载的 /dev/dsk 链路项匹配:


    # 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 ->
    
     ../../devices/pci@0,0/pci925,1234@7,2/storage@2/disk@0,0:a
  4. 挂载 USB 相机文件系统。

    该相机的文件系统很可能是 PCFS 文件系统。如果文件系统是 PCFS,则该文件系统应由 vold 自动挂载。

    要在 x86 系统上手动挂载文件系统,可以使用如下语法:


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

    要在 SPARC 系统上手动挂载文件系统,可以使用如下语法:


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

    有关挂载文件系统的信息,请参见第 19 章,挂载和取消挂载文件系统(任务)

    有关挂载其他 PCFS 文件系统的信息,请参见 mount_pcfs(1M)

  5. 检验图像文件是否可用。

    例如:


    # ls /mnt/DCIM/100OLYMP/
    
    P7220001.JPG*  P7220003.JPG*  P7220005.JPG*
    
    P7220002.JPG*  P7220004.JPG*  P7220006.JPG*
  6. 查看并处理 USB 相机创建的图像文件。

    例如:


    # /usr/dt/bin/sdtimage P7220001.JPG &
    
  7. 断开相机连接之前,取消挂载文件系统。

    例如:


    # umount /mnt
    
  8. (可选的)关闭并断开相机连接。

Procedure如何在不运行 vold 的情况下移除 USB 海量存储设备

  1. (可选)有关禁用 vold 的信息,请参见如何在不运行 vold 的情况下准备使用 USB 海量存储设备

  2. 成为超级用户。

  3. 检验 vold 是否未运行。


    # svcs volfs
    
    STATE          STIME    FMRI
    
    disabled       Sep_29   svc:/system/filesystem/volfs:default
  4. 停止使用该设备的所有活动应用程序。

  5. 取消挂载该设备。

  6. 移除该设备。

在运行 vold 的情况下准备使用 USB 海量存储设备

无论是否使用卷管理,都可以访问有关可移除介质的信息。有关使用 GNOME 的文件管理器访问可移除介质相关信息的信息,请参见 GNOME 桌面文档。

格式化 USB 设备后,通常会将该设备挂载于 /rmdisk/label 目录下。有关配置可移除存储设备的更多信息,请参见 rmmount.conf(4)vold.conf(4)

设备节点是在 /vol/dev 目录下创建的。有关更多信息,请参见 scsa2usb(7D)

以下过程介绍如何在不运行 vold 的情况下管理 USB 海量存储设备。对于字符设备,对应的设备节点是在 /dev/rdsk 目录下创建的,而对于块设备,对应的设备节点是在 /dev/dsk 目录下创建的。设备链路是在热插拔设备时创建的。有关更多信息,请参见 scsa2usb(7D)

Procedure如何在不运行 vold 的情况下准备使用 USB 海量存储设备

可以在不运行卷管理 (vold) 的情况下使用 USB 海量存储设备。可通过发出以下命令停止 vold


# svcadm disable volfs

或者,使用以下过程使 vold 保持运行,但不使用 vold 来注册 USB 海量存储设备。

  1. 成为超级用户。

  2. 检验 vold 是否未运行。


    # svcs volfs
    
    STATE          STIME    FMRI
    
    disabled       10:28:23 svc:/system/filesystem/volfs:default
  3. 通过对 /etc/vold.conf 文件中的以下行进行注释,删除 USB 海量存储设备的卷管理注册功能。


    # use rmdisk drive /dev/rdsk/c*s2 dev_rmdisk.so rmdisk%d
  4. 注释该行后,重新启动 vold


    # svcadm enable volfs
    

    注意 – 注意 –

    如果注释掉该行,且其他可移除设备(如 SCSI 或 Peerless)位于系统上,则这些设备的 vold 注册功能也会被禁用。


    有关更多信息,请参见 vold.conf(4)

Procedure如何显示 USB 设备信息

    显示有关 USB 设备的信息。

    例如,使用 prtconf 命令可显示 USB 设备信息。本示例中的 prtconf 输出已截断为仅显示 USB 设备信息。


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

    例如,使用 rmformat 命令可显示 USB 设备信息。


    $ rmformat
    
    Looking for devices...
    
         1. Volmgt Node: /vol/dev/aliases/rmdisk3
    
            Logical Node: /dev/rdsk/c1t0d3s2
    
            Physical Node: /pci@1e,600000/usb@a/storage@2/disk@0,3
    
            Connected Device: SMSC     223 U HS-SD/MMC  1.95
    
            Device Type: Removable
    
         2. Volmgt Node: /vol/dev/aliases/cdrom0
    
            Logical Node: /dev/rdsk/c2t2d0s2
    
            Physical Node: /pci@1e,600000/ide@d/sd@2,0
    
            Connected Device: JLMS     XJ-HD166S        D3S4
    
            Device Type: DVD Reader
    
         3. Volmgt Node: /vol/dev/aliases/rmdisk4
    
            Logical Node: /dev/rdsk/c4t0d0s2
    
            Physical Node: /pci@1e,600000/usb@a/storage@1/disk@0,0
    
            Connected Device: IC25T048 ATDA05-0         DA8O
    
            Device Type: Removable

Procedure如何在不运行 vold 的情况下在 USB 海量存储设备中创建文件系统

使用此过程可向 USB 海量存储设备中添加文件系统。

必须先格式化 USB 软盘,然后才能向其中添加文件系统。所有其他的 USB 海量存储设备只需 PCFS 或 UFS 文件系统即可使用。格式化 USB 软盘时,请牢记以下要点:


注 –

仅在需要格式化 USB 软盘时,才执行步骤 5–6。


  1. (可选)有关禁用 vold 的信息,请参见如何在不运行 vold 的情况下准备使用 USB 海量存储设备

  2. 检验 vold 是否未运行。


    # svcs volfs
    
    STATE          STIME    FMRI
    
    disable        10:39:12 svc:/system/filesystem/volfs:default
  3. 向系统中添加 USB 设备。

    有关热插拔 USB 设备的信息,请参见:

  4. (可选)标识 USB 设备。

    以下示例标识了 USB 软盘设备。


    # cd /dev/rdsk
    
    # 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

    在本示例中,软盘设备为 c2t0d0s0

  5. 将软盘插入软盘驱动器中(如果必要)。

  6. 格式化该软盘(如果必要)。


    % rmformat -Flong raw-device
    

    例如,在 SPARC 系统上:


    % rmformat -Flong /dev/rdsk/c2t0d0s2
    

    例如,在 x86 系统上:


    % rmformat -Flong /dev/rdsk/c3t0d0p0
    
  7. 确定文件系统类型并选择以下操作之一:

    • 创建 PCFS 文件系统。


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

      以 512 字节块为单位指定 -size 选项。

      以下示例说明如何在 SPARC 系统中的 1.4 MB 软盘上创建 PCFS 文件系统:


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

      以下示例说明如何在 x86 系统中的 1.4 MB 软盘上创建 PCFS 文件系统:


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

      以下示例说明如何在 SPARC 系统上的 100 MB USB 内存条上创建 PCFS 文件系统:


      # mkfs -F pcfs /dev/rdsk/c5t0d0s2:c
      

      以下示例说明如何在 x86 系统上的 100 MB USB 内存条上创建 PCFS 文件系统:


      # mkfs -F pcfs /dev/rdsk/c5t0d0p0:c
      

      完成此命令可能要用几分钟时间。

    • 创建 UFS 文件系统。


      # newfs raw-device
      

      例如:


      # newfs /dev/rdsk/c4t0d0s7
      

      对于大容量 USB 硬盘,请考虑使用 newfs -f 4096 选项或 newfs -T 选项。


      注 –

      由于软盘的存储容量有限,因此 UFS 文件系统开销会占用软盘上的大部分空间。


    有关在 USB 海量存储设备中创建 PCFS 文件系统和修改片的详细示例,请参见以下两个过程。

Procedure如何在不运行 vold 的情况下在 USB 海量存储设备中修改分区和创建 PCFS 文件系统

以下步骤介绍如何删除现有分区,创建新分区,然后在 USB 设备中创建 PCFS 文件系统。执行此任务之前,请确保先备份所有数据。

  1. 成为超级用户。

  2. 启动 fdisk 实用程序。

    例如:


    # fdisk /dev/rdsk/c3t0d0p0
    
  3. 通过选择选项 3 来删除分区。

    例如:


          Total disk size is 29 cylinders
    
                 Cylinder size is 2048 (512 byte) blocks
    
    
    
                                                   Cylinders
    
          Partition   Status    Type          Start   End   Length    %
    
          =========   ======    ============  =====   ===   ======   ===
    
              1       Active    Solaris2          1    28      28     97
    
    
    
    SELECT ONE OF THE FOLLOWING:
    
       1. Create a partition
    
       2. Specify the active partition
    
       3. Delete a partition
    
       4. Change between Solaris and Solaris2 Partition IDs
    
       5. Exit (update disk configuration and exit)
    
       6. Cancel (exit without updating disk configuration)
    
    Enter Selection: 3
    
  4. 选择要删除的分区号。

    例如:


          Total disk size is 29 cylinders
    
                 Cylinder size is 2048 (512 byte) blocks
    
    
    
                                                   Cylinders
    
          Partition   Status    Type          Start   End   Length    %
    
          =========   ======    ============  =====   ===   ======   ===
    
              1       Active    Solaris2          1    28      28     97
    
    
    
    SELECT ONE OF THE FOLLOWING:
    
       1. Create a partition
    
       2. Specify the active partition
    
       3. Delete a partition
    
       4. Change between Solaris and Solaris2 Partition IDs
    
       5. Exit (update disk configuration and exit)
    
       6. Cancel (exit without updating disk configuration)
    
    Specify the partition number to delete (or enter 0 to exit): 1
    
    
    
    Partition deleted.
  5. 创建分区。

    例如:


          Total disk size is 29 cylinders
    
                 Cylinder size is 2048 (512 byte) blocks
    
    
    
                                                   Cylinders
    
          Partition   Status    Type          Start   End   Length    %
    
          =========   ======    ============  =====   ===   ======   ===
    
    
    
    WARNING: no partitions are defined!
    
    
    
    SELECT ONE OF THE FOLLOWING:
    
       1. Create a partition
    
       2. Specify the active partition
    
       3. Delete a partition
    
       4. Change between Solaris and Solaris2 Partition IDs
    
       5. Exit (update disk configuration and exit)
    
       6. Cancel (exit without updating disk configuration)
    
    Enter Selection: 1
    
  6. 选择 FAT32 分区类型。


          Total disk size is 29 cylinders
    
                 Cylinder size is 2048 (512 byte) blocks
    
    
    
                                                   Cylinders
    
          Partition   Status    Type          Start   End   Length    %
    
          =========   ======    ============  =====   ===   ======   ===
    
    
    
    WARNING: no partitions are defined!
    
    
    
    SELECT ONE OF THE FOLLOWING:
    
       1. Create a partition
    
       2. Specify the active partition
    
       3. Delete a partition
    
       4. Change between Solaris and Solaris2 Partition IDs
    
       5. Exit (update disk configuration and exit)
    
       6. Cancel (exit without updating disk configuration)
    
    Select the partition type to create:
    
       1=SOLARIS2  2=UNIX        3=PCIXOS     4=Other    
    
       5=DOS12     6=DOS16       7=DOSEXT     8=DOSBIG
    
       9=DOS16LBA  A=x86 Boot    B=Diagnostic C=FAT32
    
       D=FAT32LBA  E=DOSEXTLBA   F=EFI        0=Exit? c
    
  7. 指定此分区所使用的磁盘百分比。


           Total disk size is 29 cylinders
    
                  Cylinder size is 2048 (512 byte) blocks
    
    
    
                                                   Cylinders
    
          Partition   Status    Type          Start   End   Length    %
    
          =========   ======    ============  =====   ===   ======   ===
    
    
    
    WARNING: no partitions are defined!
    
    
    
    SELECT ONE OF THE FOLLOWING:
    
       1. Create a partition
    
       2. Specify the active partition
    
       3. Delete a partition
    
       4. Change between Solaris and Solaris2 Partition IDs
    
       5. Exit (update disk configuration and exit)
    
       6. Cancel (exit without updating disk configuration)
    
    Select the partition type to create:
    
    Specify the percentage of disk to use for this partition (or type "c" to 
    
    specify the size in cylinders). 100
    
  8. 选择新分区应为活动分区还是非活动分区。


                  Total disk size is 29 cylinders
    
                  Cylinder size is 2048 (512 byte) blocks
    
    
    
                                                   Cylinders
    
          Partition   Status    Type          Start   End   Length    %
    
          =========   ======    ============  =====   ===   ======   ===
    
    
    
    WARNING: no partitions are defined!
    
    
    
    SELECT ONE OF THE FOLLOWING:
    
       1. Create a partition
    
       2. Specify the active partition
    
       3. Delete a partition
    
       4. Change between Solaris and Solaris2 Partition IDs
    
       5. Exit (update disk configuration and exit)
    
       6. Cancel (exit without updating disk configuration)
    
    Select the partition type to create:
    
    Should this become the active partition? If yes, it  will be activated 
    
    each time the computer is reset or turned on.
    
    Please type "y" or "n". n
    
  9. 更新磁盘配置并退出。


          Total disk size is 29 cylinders
    
                 Cylinder size is 2048 (512 byte) blocks
    
    
    
                                                   Cylinders
    
          Partition   Status    Type          Start   End   Length    %
    
          =========   ======    ============  =====   ===   ======   ===
    
              1                 Win95 FAT32       1    28      28     97
    
    
    
    SELECT ONE OF THE FOLLOWING:
    
       1. Create a partition
    
       2. Specify the active partition
    
       3. Delete a partition
    
       4. Change between Solaris and Solaris2 Partition IDs
    
       5. Exit (update disk configuration and exit)
    
       6. Cancel (exit without updating disk configuration)
    
    Enter Selection: 5
    
  10. 在此分区中创建 PCFS 文件系统。

    例如:


    # mkfs -F pcfs -o fat=32 /dev/rdsk/c3t0d0p0:c
    
    Construct a new FAT file system on /dev/rdsk/c3t0d0p0:c: (y/n)? y
    
    

Procedure如何在不运行 vold 的情况下在 USB 海量存储设备中创建 Solaris 分区和修改片

以下步骤说明如何创建 Solaris 分区和修改片。

有关禁用 vold 的信息,请参见如何在不运行 vold 的情况下准备使用 USB 海量存储设备

执行此任务之前,请确保先备份所有数据。

  1. 成为超级用户。

  2. 启动 fdisk 实用程序。

    例如:


    # fdisk /dev/rdsk/c5t0d0s2
    
    No fdisk table exists. The default partition for the disk is:
    
    
    
      a 100% "SOLARIS System" partition
    
    
    
    Type "y" to accept the default partition,  otherwise type "n" to edit the
    
     partition table.
    
    y
    
  3. 显示当前的片。

    例如:


    # prtvtoc /dev/rdsk/c5t0d0s2
    
    * /dev/rdsk/c5t0d0s2 partition map
    
    *
    
    * Dimensions:
    
    *     512 bytes/sector
    
    *      63 sectors/track
    
    *     255 tracks/cylinder
    
    *   16065 sectors/cylinder
    
    *    5836 cylinders
    
    *    5836 accessible cylinders
    
    *
    
    * Flags:
    
    *   1: unmountable
    
    *  10: read-only
    
    *
    
    *                          First     Sector    Last
    
    * Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
    
           0      0    00          0  93755340  93755339
    
           2      0    00          0  93755340  93755339
  4. 创建包含片信息的文本文件。

    例如:


    slices: 0 = 0, 5GB, "wm", "home" :
    
            1 = 8225280000, 6GB :
    
            2 = 0, 44GB, "wm", "backup" :
    
            6 = 16450560000, 15GB

    请确保每个片都从柱面边界开始。例如,片 1 的初始大小为 822280000 字节,即柱面大小与 1000 的乘积(以字节为单位)。

    有关更多信息,请参见 rmformat(1) 中的 -s 选项说明。

  5. 通过包含以上创建的片文件来创建片。

    例如:


    # rmformat -s slice_file /dev/rdsk/c5t0d0s2
    
  6. 查看新的片信息。

    例如:


    # prtvtoc /dev/rdsk/c5t0d0s2
    
    * /dev/rdsk/c5t0d0s2 partition map
    
    *
    
    * Dimensions:
    
    *     512 bytes/sector
    
    *      63 sectors/track
    
    *     255 tracks/cylinder
    
    *   16065 sectors/cylinder
    
    *    5836 cylinders
    
    *    5836 accessible cylinders
    
    *
    
    * Flags:
    
    *   1: unmountable
    
    *  10: read-only
    
    *
    
    * Unallocated space:
    
    *       First     Sector    Last
    
    *       Sector     Count    Sector
    
    *    10485760   5579240  16064999
    
    *    28647912   3482088  32129999
    
    *    63587280  30168060  93755339
    
    *
    
    *                          First     Sector    Last
    
    * Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
    
           0      8    00          0  10485760  10485759
    
           1      3    01   16065000  12582912  28647911
    
           2      5    00          0  92274688  92274687
    
           6      4    00   32130000  31457280  63587279

Procedure如何在不运行 vold 的情况下挂载或取消挂载 USB 海量存储设备

  1. 有关禁用 vold 的信息,请参见如何在不运行 vold 的情况下准备使用 USB 海量存储设备

  2. 成为超级用户。

  3. 检验 vold 是否未运行。


    # svcs volfs
    
    STATE          STIME    FMRI
    
    disabled       10:39:12 svc:/system/filesystem/volfs:default
  4. (可选)标识该设备。

    例如:


    # cd /dev/rdsk
    
    # 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

    在本示例中,软盘设备为 c2t0d0s0

  5. 选择以下操作之一以挂载或取消挂载 USB 海量存储设备:

    • 挂载 USB 海量存储设备。


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

      本示例说明如何挂载包含 UFS 文件系统的设备:


      # mount /dev/dsk/c1t0d0s2 /mnt
      

      本示例说明如何在 SPARC 系统上挂载包含 PCFS 文件系统的设备:


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

      本示例说明如何在 x86 系统上挂载包含 PCFS 文件系统的设备:


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

      本示例说明如何挂载包含只读 HSFS 文件系统的 CD:


      # mount -F hsfs -o ro /dev/dsk/c1t0d0s2 /mnt
      
    • 取消挂载 USB 海量存储设备。

      首先,确保无人正在使用该设备中的文件系统。

      例如:


      # fuser -c -u /mnt
      
      # umount /mnt
      
  6. 弹出该设备(对于 CD 或软盘设备,此操作可选)。


    # eject /dev/[r]dsk/cntndnsn
    

    例如:


    # eject /dev/rdsk/c1t0d0s2
    

USB 海量存储设备的疑难解答提示

如果在添加或移除 USB 海量存储设备时遇到问题,请牢记以下提示。

请检查 /var/adm/messages 文件中枚举该设备时出现的故障。对于枚举故障,可能需要插入 USB 集线器,或移除集线器并将其直接连接至根 USB 集线器。

禁用特定的 USB 驱动程序

通过禁用 USB 设备的客户机驱动程序,可以禁用特定类型的 USB 设备。例如,通过禁用驱动 USB 打印机的 usbprn 驱动程序,可以禁用这些打印机。禁用 usbprn 不会影响其他种类的设备,如 USB 存储设备。

下表提供了一些 USB 设备类型及其对应的驱动程序。

设备类型 

要禁用的驱动程序 

音频 

usb_acusb_as

HID(通常为键盘和鼠标) 

hid

存储 

scsa2usb

打印机 

usbprn

串行 

usbser_edge

如果禁用仍与系统连接的 USB 设备的驱动程序,则会显示类似如下的控制台消息:


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

Procedure如何禁用特定的 USB 驱动程序

  1. 成为超级用户。

  2. /etc/system 文件中排除驱动程序别名项。

    例如,包含以下排除语句,用于排除 usbprn 驱动程序。


    exclude: usbprn
  3. 重新引导系统。


    # init 6
    

Procedure如何删除未使用的 USB 设备链路

如果在系统电源关闭时移除 USB 设备,请使用此过程。在系统电源关闭时移除 USB 设备可能会保留不存在设备的设备链路。

  1. 成为超级用户。

  2. 关闭可能正在访问该设备的所有应用程序。

  3. 删除特定 USB 类的未使用的链路。

    例如:


    # devfsadm -C -c audio
    

    或者,直接删除悬而未决的链路:


    # devfsadm -C