5

I'm running Ubuntu 14.01 on a BeagleBone Black with LXDE. I have a USB hard drive that auto mounts (a prompt comes up in LXDE and I have to enter my password) if I connect it after the computer have booted. I can then also see the USB hard drive under /dev/. But If I have the USB hard drive connected when the computer boots up then I can't see the hard drive under /dev/. Any suggestions what I can do to fix the issue?

This is the output from lsusb when the USB hard drive is connected during boot

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

This is the output from just sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL (I skipped the /dev/[sh]d since the USB hard drive is not available under /dev/) when the USB hard drive is connected during boot

NAME         FSTYPE   SIZE MOUNTPOINT  LABEL
mmcblk0boot0            1M             
mmcblk0boot1            1M             
mmcblk0               1.8G             
├─mmcblk0p1  vfat       1M /boot/uboot boot
└─mmcblk0p2  ext4     1.8G /           rootfs

This is the output from lsusb when the UBS hard drive is connected after boot

Bus 001 Device 002: ID 152d:2338 JMicron Technology Corp. / JMicron USA Technology Corp. JM20337 Hi-Speed USB to SATA & PATA Combo Bridge
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

This is the output from sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL /dev/sda when the UBS hard drive is connected after boot and "auto mounted" through LXDE (a prompt comes up and I have to enter my password)

NAME   FSTYPE   SIZE MOUNTPOINT  LABEL
sda           931.5G                                                    
└─sda1 ext4   931.5G /media/mikael/b4c5600d-f0e0-4bc9-83e4-caf6db38258e

This is the output from dmesg just after connecting the USB hard drive after boot

[  347.032628] usb usb1: usb wakeup-resume
[  347.032735] usb usb1: usb auto-resume
[  347.032758] hub 1-0:1.0: hub_resume
[  347.032857] hub 1-0:1.0: port 1: status 0101 change 0001
[  347.135340] hub 1-0:1.0: state 7 ports 1 chg 0002 evt 0000
[  347.135410] hub 1-0:1.0: port 1, status 0101, change 0000, 12 Mb/s
[  347.240770] usb 1-1: new high-speed USB device number 2 using musb-hdrc
[  347.360705] usb 1-1: default language 0x0409
[  347.361123] usb 1-1: udev 2, busnum 1, minor = 1
[  347.361204] usb 1-1: New USB device found, idVendor=152d, idProduct=2338
[  347.361218] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=5
[  347.361229] usb 1-1: Product: USB to ATA/ATAPI bridge
[  347.361239] usb 1-1: Manufacturer: JMicron
[  347.361249] usb 1-1: SerialNumber: 1208891D9014
[  347.365968] usb 1-1: usb_probe_device
[  347.365997] usb 1-1: configuration #1 chosen from 1 choice
[  347.366360] usb 1-1: adding 1-1:1.0 (config #1, interface 0)
[  347.368713] usb-storage 1-1:1.0: usb_probe_interface
[  347.368747] usb-storage 1-1:1.0: usb_probe_interface - got id
[  347.380506] scsi0 : usb-storage 1-1:1.0
[  347.382266] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002
[  347.382323] hub 1-0:1.0: port 1 enable change, status 00000503
[  350.375785] scsi 0:0:0:0: Direct-Access     ST1000LM 024 HN-M101MBB        PQ: 0 ANSI: 2 CCS
[  350.442820] sd 0:0:0:0: [sda] 244190646 4096-byte logical blocks: (1.00 TB/931 GiB)
[  350.443523] sd 0:0:0:0: [sda] Write Protect is off
[  350.443545] sd 0:0:0:0: [sda] Mode Sense: 28 00 00 00
[  350.444583] sd 0:0:0:0: [sda] No Caching mode page present
[  350.450573] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  350.470712] sd 0:0:0:0: [sda] 244190646 4096-byte logical blocks: (1.00 TB/931 GiB)
[  350.474565] sd 0:0:0:0: [sda] No Caching mode page present
[  350.481187] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  350.547808]  sda: sda1
[  350.550022] sd 0:0:0:0: [sda] 244190646 4096-byte logical blocks: (1.00 TB/931 GiB)
[  350.550965] sd 0:0:0:0: [sda] No Caching mode page present
[  350.557204] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  350.563590] sd 0:0:0:0: [sda] Attached SCSI disk
[  368.429266] EXT4-fs (sda1): recovery complete
[  368.429980] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
  • Can you append the output of lsusb and sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL /dev/[sh]d? please? – David Foerster Sep 13 '14 at 19:38
  • Could this be a a udev issue? That a rule is missing for the USB hard drive? @DavidFoerster – g3blv Sep 15 '14 at 19:16
  • 1
    Your computer sees the USB to ATA adapter of the external hard drive fine, but for some reason it doesn't create a block device for the attached storage. Can you append the output of dmesg just after plugging in the hard drive? The relevant section should be the last tens of lines or so. – David Foerster Sep 15 '14 at 19:23
  • Have you recently upgraded your kernel and not rebooted yet? If so, you might want to look at this. – Matthias Braun Aug 1 '17 at 18:24
0

One way to resolve this issue would be to trigger udev to rescan devices. Here's an example of the command and an excerpt of the relevant output. (the -v is for verbose)

If you've changed any of the udev rules you should begin with:

sudo udevadm control --reload-rules

sudo udevadm trigger -v

/sys/devices/pci0000:00/0000:00:1d.0/usb2
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-0:1.0
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host6
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host6/scsi_host/host6
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host6/target6:0:0
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host6/target6:0:0/6:0:0:0
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host6/target6:0:0/6:0:0:0/block/sdd
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host6/target6:0:0/6:0:0:0/block/sdd/sdd1
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host6/target6:0:0/6:0:0:0/block/sdd/sdd2
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host6/target6:0:0/6:0:0:0/bsg/6:0:0:0
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host6/target6:0:0/6:0:0:0/scsi_device/6:0:0:0
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host6/target6:0:0/6:0:0:0/scsi_disk/6:0:0:0
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host6/target6:0:0/6:0:0:0/scsi_generic/sg4
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0

Note that your actual output will by far exceed this as udev will rescan everything in /sys/devices/

Note: According to my tests (watching the output of udevadm monitor), sudo is required. No errors will appear if you leave it out, but nothing will happen either.

Further note: Tests were conducted on a mostly idle system and no ill effects were detected. I have not tested this approach on a system under heavy load. Full disclosure as I've seen strange results on systems under heavy load in the past.

You can narrow the effects to a specific device utilizing the --attr-match=switch.

To obtain the attributes that you can use for your specific device issue the command udevadm info -q all -n /dev/sXY where /dev/sXY is your block device. mine was /dev/sdd.

Another more targeted approach is to echo change | sudo tee /sys/block/sdd/sdd1/uevent (where sdd is your drive and sdd1 is your partition).

The positive side of this approach is the precise targeting of the device. The negative side being that you have to actually know what device you are targeting.

Sources:

https://unix.stackexchange.com/questions/39370/how-to-reload-udev-rules-without-reboot

https://unix.stackexchange.com/questions/124817/udev-how-do-i-find-out-which-subsystem-a-device-belongs-to

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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