USB storage and Linux (OracleVM)

I wanted to connect a USB storage device to my VM Master which is running Oracle Enterprise Linux Release 4 but was having problems. The key problem that I was having was that the disk was never recognized. I tried looking at the kernel and it appears to have the module configured. To verify this I looked at


/lib/modules/2.6.9-55.0.0.0.2.EL/kernel/drivers/usb/storage


This directory contains usb-storage.ko which appears to be compiled for this kernel. Since we are running this kernel we should either have the module included as part of the operating system or loaded when a device is attached.


If I attach a device to the USB bus I should see a /dev/sda? listed as a recognizable device. I should also be able to see something in the dmesg console that a device was loaded on the usb bus. To verify this type


$ dmesg | grep -i sd


You should see


SCSI device sda: followed by some data on how big the disk is and how it is partitioned as well as


USB mass storage support registered


if you do an


$ ls -al /dev/sda*


you should see


brw-rw—- 1 root disk 8, 0 Feb 18 21:00 /dev/sda


brw-rw—- 1 root disk 8,1 Feb 18 21:00 /dev/sda1


brw-rw—- 1 root disk 8,2 Feb 18 21:00 /dev/sda2


This shows that a device was created corresponding to a USB storage device on Feb 18th at 21:00. The device has two partitions and should be available for use. When I first looked at the device using the fdisk command, I saw that it was partially formatted for Linux and partially formatted for Windows. I changed this with the fdisk command


$ fdisk /dev/sda


Command: p


Disk /dev/sda: 92.6 GB, …….


/dev/sda1            1               13 104391      83  Linux


/dev/sda2            14       11262 90357592+ 7 HPFS/NTFS


From this we want to change the device type to Linux for sda2. To do this we enter


Command: t


Partition Number (1-4): 2


Hex code: 83


Command: w


Command: q


This sequence changes /dev/sda2 from an NTFS ready system to a Linux system. We want to do this so that we can format the disk as ext3 or some other Linux file system.


# mkfs -t ext3 /dev/sda2


Causes the disk to be reformatted using the ext3 file system. We want to do this so that the disk can be mounted and used to hold templates and iso images from the vm master system. We can also attach this system to out vm server utility disk and mount it as /OVS/iso_images to free up the internal disk on our server. We can also share these images from the vm master via nfs and not have to copy the files locally to the vm server.


When I first tried doing this on an old Toshiba Tecra laptop, it did not work. The problem is that this system has two different USB connections, a type one and type two USB connector. The type one USB connector would not recognize the disk. I had to unplug and replug the usb cable into the other USB connector and it worked.


Once the mkfs command finished, I was able to mount the disk with


# mount /dev/sda2 /media/usbdisk


and verify that it mounted with


# df -k


With this you should see /dev/sda2 mounted on /media/usbdisk along with the other disks that are mounted.


I did do some simple testing to see how small the dom-0 kernel is when compared to a command line installation of Enterprise Linux Release 4 Update 5. In the VM Master there are 763 packages installed. In the OELR4 there are 309 packages installed. It also appears that the VM Master software is a superset of the core packages. The same is not true with VM Server and the OELR5 core packages. The VM Server has 363 packages and the OELR5 has 437 packages.  A few of the core packages that are the same have different versions.