Dealing with USB Storage devices on OmniOS
1218 words, 6 minutes
I want to deal with flash, SSD and SATA drives connected to a ThinkPad A485 using its USB ports. This is my cheatsheet based on Managing USB Mass Storage Devices on Oracle Solaris 11.2 .
Identifying USB Mass Storage Devices
Logs
The logs indicate when new USB hardware is connected or removed from the computer.
This is a Corsair VoyagerGT 16GB connected to a USB 3 port.
# tail -f /var/adm/messages
usba: [ID 912658 kern.info] USB 2.0 device (usb1b1c,1a90) operating at hi speed (USB 2.x) on USB 3.1 root hub: storage@2, scsa2usb2 at bus address 2
usba: [ID 349649 kern.info] Corsair VoyagerGT AA04012700009738
genunix: [ID 936769 kern.info] scsa2usb2 is /pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@2
genunix: [ID 408114 kern.info] /pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@2 (scsa2usb2) online
scsi: [ID 583861 kern.info] sd2 at scsa2usb2: target 0 lun 0
genunix: [ID 936769 kern.info] sd2 is /pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@2/disk@0,0
genunix: [ID 408114 kern.info] /pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@2/disk@0,0 (sd2) online
genunix: [ID 127566 kern.info] device pciclass,030000@0(display#0) keeps up device sd@0,0(disk#2), but the former is not power managed
This is a 1TB SABRENT NVMe M.2 SSD connected to a USB-C port
usba: [ID 912658 kern.info] USB 3.20 device (usb152d,583) operating at super speed (USB 3.x) on USB 3.1 root hub: storage@8, scsa2usb3 at bus address 3
usba: [ID 349649 kern.info] SABRENT SABRENT DD56419883896
genunix: [ID 936769 kern.info] scsa2usb3 is /pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@8
genunix: [ID 408114 kern.info] /pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@8 (scsa2usb3) online
scsi: [ID 583861 kern.info] sd3 at scsa2usb3: target 0 lun 0
genunix: [ID 936769 kern.info] sd3 is /pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@8/disk@0,0
genunix: [ID 408114 kern.info] /pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@8/disk@0,0 (sd3) online
On this particuar machine, the following warning pops up regularly.
usba: [ID 691482 kern.warning] WARNING: \
/pci@0,0/pci1022,15d3@1,4/pci17aa,5122@0,4 (ehci0): No SOF interrupts \
have been received, this USB EHCI hostcontroller is unusable
According to illumos gate , this is not really harmfull. I couldn’t have it go while changing parameters on the BIOS.
System configuration
The USB devices are displayed in the system configuration tool.
# prtconf -dD
System Configuration: LENOVO i86pc
Memory size: 23459 Megabytes
System Peripherals (Software Nodes):
i86pc (driver name: rootnex)
scsi_vhci, instance #0 (driver name: scsi_vhci)
pci, instance #0 (driver name: npe)
pci1022,15db (pciex1022,15db) [Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Internal PCIe GPP Bridge 0 to Bus A], instance #5 (driver name: pcieb)
pci17aa,5122 (pciex1022,15e0) [Advanced Micro Devices, Inc. [AMD] Raven USB 3.1], instance #0 (driver name: xhci)
storage, instance #1 (driver name: scsa2usb)
disk, instance #1 (driver name: sd)
storage, instance #3 (driver name: scsa2usb)
disk, instance #3 (driver name: sd)
storage, instance #4 (driver name: scsa2usb)
disk, instance #4 (driver name: sd)
Removable rewritable media format utility
On OmniOS, the rmformat
does not seem to be installed by default.
# pkg install pkg:/service/storage/media-volume-manager
Display the USB device information:
# rmformat
Looking for devices...
1. Logical Node: /dev/rdsk/c2t0d0p0
Physical Node: /pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@3/disk@0,0
Connected Device: Corsair VoyagerGT 1100
Device Type: Removable
Bus: USB
Size: 15,3 GB
Label: <Unknown>
Access permissions: Medium is not write protected.
2. Logical Node: /dev/rdsk/c4t0d0p0
Physical Node: /pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@6/disk@0,0
Connected Device: Samsung SSD 870 QVO 4TB 0
Device Type: Removable
Bus: USB
Size: 3815,4 GB
Label: <Unknown>
Access permissions: Medium is not write protected.
3. Logical Node: /dev/rdsk/c6t0d0p0
Physical Node: /pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@8/disk@0,0
Connected Device: SABRENT 0208
Device Type: Removable
Bus: USB
Size: 953,9 GB
Label: <Unknown>
Access permissions: Medium is not write protected.
USB Flash Drive
Format the flash drive using FAT.
# format -e
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1t6479A74150301EB0d0 <NVMe-Sabrent-RKT303.3-953.87GB>
/pci@0,0/pci1022,15d3@1,3/pci1987,5012@0/blkdev@w6479A74150301EB0,0
1. c2t0d0 <Corsair-VoyagerGT-1100 cyl 1947 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@3/disk@0,0
2. c4t0d0 <Samsung-SSD 870 QVO 4TB-0-3.64TB>
/pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@6/disk@0,0
3. c6t0d0 <SABRENT--0208-931.51GB>
/pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@8/disk@0,0
Specify disk (enter its number): 1
format> current
Current Disk = c2t0d0
<Corsair-VoyagerGT-1100 cyl 1947 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@3/disk@0,0
format> inquiry
Vendor: Corsair
Product: VoyagerGT
Revision: 1100
format> fdisk
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.
n
(...)
SELECT ONE OF THE FOLLOWING: 1. Create a partition
Select the partition type to create: C=FAT32
Specify the percentage of disk to use for this partition 100
Should this become the active partition? n
Enter Selection: 6. Exit (update disk configuration and exit)
format> quit
# mkfs -F pcfs -o fat=32 /dev/rdsk/c2t0d0p0:c
Construct a new FAT file system on /dev/rdsk/c2t0d0p0:c: (y/n)? y
Mount, copy data and unmount the device.
# mount -F pcfs /dev/dsk/c2t0d0p0:c /mnt
# dmesg > /mnt/dmesg.txt
# df -h
Filesystem Size Used Available Capacity Mounted on
(...)
/dev/dsk/c2t0d0p0:c 14,89G 32K 14,89G 1% /mnt
# umount /mnt
USB NVMe/SATA Drive
Using FAT32
Create the partition.
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
(...)
2. c6t0d0 <SABRENT--0208-931.51GB>
/pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@8/disk@0,0
Specify disk (enter its number): 2
selecting c6t0d0
[disk formatted]
format> current
Current Disk = c6t0d0
<SABRENT--0208-931.51GB>
/pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@8/disk@0,0
format> inquiry
Vendor: SABRENT
Product:
Revision: 0208
format> fdisk
Enter Selection: 3. Delete a partition
Specify the partition number to delete (or enter 0 to exit): 1
Are you sure you want to delete partition 1? This will make all files and
programs in this partition inaccessible (type "y" or "n"). y
Enter Selection: 1. Create a partition
Select the partition type to create: C=FAT32
Specify the percentage of disk to use for this partition
(or type "c" to specify the size in cylinders). 100
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
Enter Selection: 6. Exit (update disk configuration and exit)
format> quit
Create the FAT filesystem.
# mkfs -F pcfs -o fat=32 /dev/rdsk/c6t0d0p0:c
Construct a new FAT file system on /dev/rdsk/c6t0d0p0:c: (y/n)? y
Interact with the filesystem.
# mount -F pcfs /dev/dsk/c6t0d0p0:c /mnt
# df -h
Filesystem Size Used Available Capacity Mounted on
(...)
/dev/dsk/c6t0d0p0:c 931,38G 64K 931,38G 1% /mnt
# umount /mnt
Using NTFS
Install the NTFS tools.
# pkg install pkg:/ooce/system/file-system/ntfs-3g
Create the partition
# format
(...)
Specify disk (enter its number): 2
selecting c6t0d0
format> fdisk
Enter Selection: 3. Delete a partition
Specify the partition number to delete (or enter 0 to exit): 1
Are you sure you want to delete partition 1? y
Enter Selection: 1. Create a partition
Select the partition type to create: 4=Other
Specify the percentage of disk to use for this partition. 100
Should this become the active partition? n
Enter Selection: 6. Exit (update disk configuration and exit)
format> quit
Create the NTFS filesystem.
# mkntfs --fast --label Sabrent /dev/dsk/c6t0d0p1
(...)
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
Interact with the filesystem.
# ntfs-3g /dev/dsk/c6t0d0p1 /mnt
# df -h
Filesystem Size Used Available Capacity Mounted on
(...)
/devices/pci@0,0/pci1022,15db@8,1/pci17aa,5122@0,3/storage@8/disk@0,0:r
931,49G 93,55M 931,40G 1% /mnt
# dd if=/dev/urandom of=/mnt/TEST bs=1M count=512
512+0 records in
512+0 records out
536870912 bytes (512 MiB) transferred in 35,024679 secs (15 MiB/sec)
# umount /mnt
Using ZFS
Create the zpool.
# zpool create usb-c c6t0d0
Create a dataset.
# zfs create -o mountpoint=/data -o compression=on usb-c/data
Interact with the storage.
# dd if=/dev/urandom of=/data/TEST bs=1M count=512
512+0 records in
512+0 records out
536870912 bytes (512 MiB) transferred in 13,241975 secs (39 MiB/sec)
Importing an already configured pool.
# zpool import
pool: areas
id: 16097065552020466898
state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
the '-f' flag.
see: http://illumos.org/msg/ZFS-8000-EY
config:
areas ONLINE
c4t0d0 ONLINE
# zpool import -f areas