Linux – Why isn’t sda1 showing up in dev and how can I fix that

devicesembeddedfilesystemslinuxusb

I have an embedded Linux device and I was trying to copy some files to it. I plugged in a USB stick, the dmesg shows that it was recognized, but for some reason /dev/sda1 never showed up.

I'm trying to understand what happened.. why didn't /dev/sdaX show up at all, and what can I do about that?

Here's the dmesg:

[  434.006104] usb 1-1: new full-speed USB device number 2 using musb-hdrc
[  434.066132] hub 1-0:1.0: unable to enumerate USB device on port 1
[  434.466078] usb 1-1: new high-speed USB device number 3 using musb-hdrc
[  434.606941] usb 1-1: New USB device found, idVendor=14cd, idProduct=125c
[  434.614008] usb 1-1: New USB device strings: Mfr=1, Product=3, SerialNumber=2
[  434.621548] usb 1-1: Product: Mass Storage Device
[  434.626512] usb 1-1: Manufacturer: Generic
[  434.630825] usb 1-1: SerialNumber: 125C20100726
[  434.637445] scsi0 : usb-storage 1-1:1.0
[  435.636998] scsi 0:0:0:0: Direct-Access     Mass     Storage Device        PQ: 0 ANSI: 0 CCS
[  435.649935] sd 0:0:0:0: [sda] 15644672 512-byte logical blocks: (8.01 GB/7.45 GiB)
[  435.658578] sd 0:0:0:0: [sda] Write Protect is off
[  435.663874] sd 0:0:0:0: [sda] No Caching mode page present
[  435.669696] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  435.678648] sd 0:0:0:0: [sda] No Caching mode page present
[  435.684443] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  435.692168]  sda: sda1
[  435.697256] sd 0:0:0:0: [sda] No Caching mode page present
[  435.703051] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  435.709499] sd 0:0:0:0: [sda] Attached SCSI removable disk

And I checked /proc/partitions and I can see it present there:

-sh-4.2# cat partitions
major minor  #blocks  name

  31        0        128 mtdblock0
  31        1        256 mtdblock1
  31        2         64 mtdblock2
  31        3       1408 mtdblock3
  31        4       2560 mtdblock4
  31        5       3776 mtdblock5
  31        6       8192 mtdblock6
 179        0    7822336 mmcblk0
 179        1      72261 mmcblk0p1
 179        2    7735297 mmcblk0p2
   8        0    7822336 sda
   8        1    7818240 sda1

And here's the snap shot of /dev, as you can see, there's no sda1:

-sh-4.2# ls /dev
Buzzer              mem                 ram5                tty39
MAKEDEV             mice                ram6                tty4
XOR                 mmcblk0             ram7                tty40
apm_bios            mmcblk0p1           ram8                tty41
console             mmcblk0p2           ram9                tty42
core                mouse0              ramdisk             tty43
cpu_dma_latency     mtd0                random              tty44
crypto              mtd0ro              rfkill              tty45
event0              mtd1                root                tty46
fb0                 mtd1ro              rtc0                tty47
fd                  mtd2                stderr              tty48
full                mtd2ro              stdin               tty49
gpioLeds            mtd3                stdout              tty5
gpioOperate         mtd3ro              timer               tty50
hda                 mtd4                tscadc-test         tty51
hda1                mtd4ro              tty                 tty52
hda10               mtd5                tty0                tty53
hda11               mtd5ro              tty1                tty54
hda12               mtd6                tty10               tty55
hda13               mtd6ro              tty11               tty56
hda14               mtd7                tty12               tty57
hda15               mtdblock0           tty13               tty58
hda16               mtdblock1           tty14               tty59
hda17               mtdblock2           tty15               tty6
hda18               mtdblock3           tty16               tty60
hda19               mtdblock4           tty17               tty61
hda2                mtdblock5           tty18               tty62
hda3                mtdblock6           tty19               tty63
hda4                mtdblock7           tty2                tty7
hda5                network_latency     tty20               tty8
hda6                network_throughput  tty21               tty9
hda7                nfsd                tty22               ttyO0
hda8                null                tty23               ttyO1
hda9                psaux               tty24               ttyO2
hw_random           ptmx                tty25               ttyO3
i2c-1               pts                 tty26               ttyO4
initctl             pvrsrvkm            tty27               ttyS0
kmem                ram                 tty28               ttySA0
kmsg                ram0                tty29               ubi_ctrl
log                 ram1                tty3                urandom
loop-control        ram10               tty30               usbdev1.1
loop0               ram11               tty31               vcs
loop1               ram12               tty32               vcs1
loop2               ram13               tty33               vcsa
loop3               ram14               tty34               vcsa1
loop4               ram15               tty35               zero
loop5               ram2                tty36
loop6               ram3                tty37
loop7               ram4                tty38

Here's the udev monitor log as well:

KERNEL[1431.270571] add      /de[ 1431.278179] scsi1 : usb-storage 1-1:1.0
vices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1 (usb)
KERNEL[1431.271543] add      /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-1:1.0 (usb)
KERNEL[1431.277947] add      /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-1:1.0/host1 (scsi)
KERNEL[1431.278561] add      /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-1:1.0/host1/scsi_host/host1 (scsi_host)
KERNEL[1431.280381] add      /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/usb_device/usbdev1.6 (usb_device)
[ 1432.287008] scsi 1:0:0:0: Direct-Access     Mass     Storage Device        PQ: 0 ANSI: 0 CCS
KERNEL[1432.291899] add      /devices/platform/o[ 1432.301160] sd 1:0:0:0: [sda] 15644672 512-byte logical blocks: (8.01 GB/7.45 GiB)
map/musb-ti81xx/[ 1432.310858] sd 1:0:0:0: [sda] Write Protect is off
musb-hdrc.1/usb1[ 1432.317254] sd 1:0:0:0: [sda] No Caching mode page present
/1-1/1-1:1.0/hos[ 1432.323863] sd 1:0:0:0: [sda] Assuming drive cache: write through
t1/target1:0:0 (scsi)
KERNEL[14[ 1432.334323] sd 1:0:0:0: [sda] No Caching mode page present
32.292637] add  [ 1432.340312] sd 1:0:0:0: [sda] Assuming drive cache: write through
    /devices/platform/omap/musb-[ 1432.349590]  sda: sda1
ti81xx/musb-hdrc.1/usb1/1-1/1-1:1.0/host1/target[ 1432.356659] sd 1:0:0:0: [sda] No Caching mode page present
1:0:0/1:0:0:0 (s[ 1432.363347] sd 1:0:0:0: [sda] Assuming drive cache: write through
csi)
KERNEL[143[ 1432.371188] sd 1:0:0:0: [sda] Attached SCSI removable disk
2.293192] add      /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-1:1.0/host1/target1:0:0/1:0:0:0/scsi_disk/1:0:0:0 (scsi_disk)
KERNEL[1432.293657] add      /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-1:1.0/host1/target1:0:0/1:0:0:0/scsi_device/1:0:0:0 (scsi_device)
KERNEL[1432.326141] add      /devices/virtual/bdi/8:0 (bdi)
KERNEL[1432.347981] add      /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-1:1.0/host1/target1:0:0/1:0:0:0/block/sda (block)
KERNEL[1432.348571] add      /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-1:1.0/host1/target1:0:0/1:0:0:0/block/sda/sda1 (block)

Best Answer

Ok, I just found half the answer to my question:

...and what can I do about that?

Apparently I can make the device node myself. I plugged the USB stick into my laptop and found it enumared as:

brw-rw---- 1 root disk 8,  0 Apr  3 13:15 /dev/sda
brw-rw---- 1 root disk 8,  1 Apr  3 13:15 /dev/sda1

So, block devices with major number 8 and minor 0 and 1. I checked the long listing of the /dev on my embedded device and found that no other device was using major version 8, so I made the nodes manually:

-sh-4.2# mknod /dev/sda b 8 0
-sh-4.2# mknod /dev/sda1 b 8 1

Then I made a directory and mounted the new sda1 to that directory:

-sh-4.2# cd /mnt/
-sh-4.2# mkdir usbdrive
-sh-4.2# mount /dev/sda1 /mnt/usbdrive/
-sh-4.2# ls /mnt/usbdrive/
libEGL.so     libsrv_um.so

And now I can see the contents of my USB drive. So that answers the "what can I do about that". I still have a question of why I need to do this manually on my embedded board. There must be something... maybe in the USB driver, that does all this automatically.

Related Question