USB Removable Devices
USB devices were developed to provide a method to attach peripheral devices such as keyboards, printers, cameras, and disk drives using a common connector and interface. Furthermore, USB devices are “hot-pluggable,” which means they can be connected or disconnected while the system is running. The OS automatically detects when a USB device has been connected and automatically configures the operating environment to make it available.
The Oracle Solaris 11 operating environment supports USB devices. When hot-plugging a USB device, the device is immediately displayed in the device hierarchy. For example, a full device pathname for a USB thumb drive connected to a SunFire T2000 system would appear as follows:
/devices/pci@7c0/pci@0/pci@1/pci@0/usb@6/hub@1/storage@2/disk@0,0
A printer would look like this:
/pci@1f,4000/usb@5/hub@3/printer@1
The steps to add a USB mass storage device are as follows:
- Insert a USB thumb drive into the USB port on your server. For this example, the device already contains a file system.
Verify that the USB device is mounted by entering the rmformat command as follows:
# rmformat<cr> Two devices are listed as follows: Looking for devices ... 1. Logical Node: /dev/rdsk/c3t0d0s2 Physical Node: /pci@7c0/pci@0/pci@1/pci@0/ide@8/sd@0,0 Connected Device: TEAC DW-224SL-R 1.0B Device Type: DVD Reader Bus: IDE Size: 525.9 MB Label: <None> Access permissions: Medium is not write protected. 2. Logical Node: /dev/rdsk/c5t0d0s2 Physical Node: /pci@7c0/pci@0/pci@1/pci@0/usb@6/hub@1/storage@2/disk@0,0 Connected Device: Generic Flash Disk 8.07 Device Type: Removable Bus: USB Size: 981.0 MB Label: <None> Access permissions: Medium is not write protected.
The first device listed is the removable DVD, and the second device listed is the removable USB thumb drive.
Verify that the device has been automatically mounted by typing
# mount<cr>
The mounted device is displayed as follows:
/media/NO NAME on /dev/dsk/c5t0d0s2:1 read/write/nosetuid/nodevices/rstchown/ hidden/nofoldcase/clamptime/noatime/timezone=18000/owner=0/group=0/mask=077/ dev=32c102a on Thu Jan 24 12:09:11 2013
The nickname for the mounted device can also be listed by typing
# rmmount –l<cr> /dev/dsk/c5t0d0s2:1 rmdisk,rmdisk0,THUMBDRIVE,/media/THUMBDRIVE /dev/dsk/c3t0d0s2 cdrom,cdrom0,cd,cd0,sr,sr0,Oracle_Solaris-11_1-Text-SPARC,/media/Oracle_Solaris-11_1-Text-SPARC
Notice the path to each device. Access the removable DVD media through this path:
/media/Oracle_Solaris-11_1-Text-SPARC
Access the USB thumb drive media through this path:
/media/THUMBDRIVE
The rmformat command is used to format, list, eject, partition, and protect removable rewritable media. If the USB device already has a file system, the device is automatically mounted. To unmount the device, type
# rmmount –u /dev/dsk/c5t0d0s2<cr> /dev/dsk/c5t0d0s2 unmounted
To format the device, type
# rmformat -F quick /dev/rdsk/c5t0d0s2<cr> Formatting will erase all the data on disk. Do you want to continue? (y/n)y<cr>
The rmformat command has three formatting options:
- quick: This option formats the media without certification or with limited certification of certain tracks on the media.
- long: This option completely formats the media.
- force: This option formats completely without user confirmation.
Create a file system on the device as follows:
# mkfs -F pcfs -o nofdisk,size=9800 /dev/rdsk/ c5t0d0s2<cr>
The mkfs command constructs a file system on a raw device. I specified –F pcfs to create a file allocation table (FAT) file system.
Be careful when removing USB devices. If the device is being used when it is disconnected, you will get I/O errors and possible data errors. When this happens, you’ll need to plug the device back in, stop the application that is using the device, and then unplug the device.
USB mass storage devices and DVD-ROMs can be inserted and automatically mounted by using the removable media services. These services are started by default and can be enabled or disabled as follows.
To prevent removable volumes from automatically mounting, disable the rmvolmgr service as follows:
# svcadm disable rmvolmgr<cr>
To disable all of the volume management media services, disable the dbus, hal, and rmvolmgr services as follows:
# svcadm disable rmvolmgr<cr> # svcadm disable dbus<cr> # svcadm disable hal<cr>
Disabling the volume management services means that you would have to mount all media manually using the mount command.
Enable removable media services:
# svcadm enable rmvolmgr<cr> # svcadm enable dbus<cr> # svcadm enable hal<cr>
When disconnecting a USB device such as a USB thumb drive, eject the device as follows:
List the removable devices as follows:
# rmmount –l<cr> /dev/dsk/c3t0d0s2 cdrom,cdrom0,cd,cd0,sr,sr0,Oracle_Solaris_Text_SPARC,/media/Oracle_Solaris_Text_SPARC /dev/dsk/c5t0d0s2:1 rmdisk,rmdisk0,NO NAME the devices currently mounted:
Unmount the device as follows:
# rmmount –u rmdisk0<cr>
Eject the device as follows:
# eject rmdisk0<cr>