Thursday, May 28, 2015

Linux -- Attached Usb disk not recognized , Linux on VM

Recently encountered an issue with a usb disk.. It was a ESX environment , and one of our databases was running on a Linux Guest Virtual Machine. (Oracle Linux 5.9 64 bit)

The ESX admin mapped the disk using his Virtual Machine Administration console tool, and notified us.

We saw the activity about the scsi disk in the kernel ring buffer (using dmesg)..

"dmesg" output:

"sd 7:0:0:0: [sdc] Attached SCSI removable disk"

dmesg was saying that, it saw the disk and the disk was associated with the device name sdc..

So far so good..

After seeing this in dmesg, we used fdisk to see the disk normally..

The strange thing was that, fdisk did not display the disk and thus we begun to think that this was a problem..

"fdisk -l"

does not display any disk with the name /dev/sdc 

This was not normal, because we already saw that the disk was attached in dmesg, and it was associated with sdc..

Also, using ls , we saw that /dev/sdc was not there at all..

At this point; as we are in such a modern System like Oracle Linux , we check the symbolic links under the /dev/disk/by-id directory;
/dev/disk/by-id shows;

[root@oracledb by-id]# pwd

[root@ermandb by-id]# ls

lrwxrwxrwx 1 root root 9 May 27 11:35 usb-Multiple_Card_Reader_058F63666433 -> ../../sdc, the serial name was there, it was obviously seen as a "Card Reader" , not a USB disk..

To crosscheck, we checked the /proc/scsi/scsi file; and it was should the Vendor as " Card Reader"
/proc/scsi/scsi shows:

Host: scsi7 Channel: 00 Id: 00 Lun: 00
  Vendor: Multiple Model: Card  Reader     Rev: 1.00
  Type:   Direct-Access                    ANSI  SCSI revision: 00

So the problem was obvious .. The usb disk was recognized, but it was recognized as a Card Reader and that 's why we could not see it on fdisk output and thus could not operate on it..

For the solution, forwarded this analysis to the ESX admin and he corrected this virtual USB disk problem.. That is , the usb port was attached to the virtual machine, but "usb device" was not  :)

So once this is corrected, Linux saw the the usb disk properly, and we could proceed..

[root@ermandb ~]#cd /dev/disk/by-id/
[root@ermandb by-id]# ls -al
lrwxrwxrwx 1 root root 9 May 28 16:26 usb-Seagate_Backup+_BK_NA518PVD -> ../../sdc

Reference: VMware

1 In the vSphere Client inventory, right-click the virtual machine and select Edit Settings.

2 Click the Hardware tab and click Add.

3 Select USB Controller and click Next.

4 Review the device information and click Next.
5 Click Finish. New USB Controller (adding) appears in the hardware list as Present.

6 Click OK to save your changes and close the dialog box.

When you reopen the Properties Editor, the controller appears on the Hardware tab.
What to do next:

Add one or more USB devices to the virtual machine -> This was missing..

No comments :

Post a Comment