Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm running CentOS 6.3 inside of VirtualBox and am having trouble seeing my USB 2.0 thumb drive. In VirtualBox I go to Devices, USB drives and can capture my connected thumb drive. I've created a mount point in CentOS but fdisk doesn't show the drive (I'm expecting to see SDC) there. What am I missing?

share|improve this question
    
What is your host OS? Can you see an event pertaining to the device in Centos' dmesg output (open a shell, plug the device in, then type dmesg followed by enter)? –  tink Mar 19 '13 at 19:40
    
What is the filesystem on your thumb drive? If it is NTFS, for instance, CentOS as shipped won't read it (needs ntfs-3g from EPEL). –  Deer Hunter Mar 19 '13 at 21:39
    
Oh, and what do you see in /media/ after capturing? –  Deer Hunter Mar 19 '13 at 21:40

2 Answers 2

An USB thumb drive should show up in sysfs under /sys/block/ and should be named sd*. Here is a short script which checks every device under /sys/block if it is an USB drive:

#!/bin/bash

function is_usb_disk()
{
        device=$1
        is_usb_attached=$(udevadm info --query=property --path="/sys/block/$device" | grep -i "^ID_BUS=usb$")
        is_disk=$(udevadm info --query=property --path="/sys/block/$device" | grep -i "^ID_TYPE=disk$")
        if [[ -n $is_usb_attached && -n $is_disk ]]; then
                return 0
        else
                return 1
        fi
}

for block_device in $(ls /sys/block); do
        is_usb_disk $block_device
        if [[ $? -eq 0 ]]; then
                serial=$(udevadm info --query=property --path="/sys/block/$block_device" | grep "^ID_SERIAL=" | cut -d "=" -f 2)
                echo "/dev/$block_device ($serial) is an USB disk."
        fi
done

This script checks for every block device if it is attached to the USB bus (via property ID_BUS) and if it is a disk (via property ID_TYPE). If it finds a device there both is true it prints the device node with the corresponding device serial.

You can just copy that to a file e.g. find_usb_disks.sh. Give it execute permission via chmod u+x find_usb_disks.sh and run it. The output will look like that:

/dev/sdb (0204_Flash_Disk_19250701EF6B1E05-0:0) is an USB disk.

If it doesn't return anything, it is likely that your thumb drive isn't "inserted" properly. Check via lsmod if modules like usb_storage are loaded. If usb_storage is not loaded, unplug your device, run

modprobe usb_storage

plug it in again and see if your thumb drive appears. A good way to monitor if your device is recognized by the kernel is

udevadm monitor

Unplug your USB device, run that command, plug your device in again. As soon as you plug your usb device in, you should see kernel (and udev) "add" actions.

Remember that if the disk has partitions a partition number will be attached to the device node name (e.g. /dev/sdb1). My script wouldn't find the partition, it just checks if a devices was added properly.

share|improve this answer

you have to install Extension pack for this . read this https://www.virtualbox.org/manual/ch01.html#intro-installing

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.