3

I'm working on a IoT Edge device based on Linux Yocto (arm_v7) and I need to mount an USB Drive.

Linux version:

root@7426a4ffc838:/# uname -a
Linux 7426a4ffc838 4.9.80-rt62 #1 SMP PREEMPT RT Thu May 14 17:11:08 UTC 2020 armv7l GNU/Linux

Since this device has no shell (only webpage), I use an docker container to try to mount the USB drive.

My container runs in privileged mode in order to access to hardware.

If I run the command "lsblk" I get this output:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0         7:0    0 363.6M  1 loop 
sda           8:0    1  14.8G  0 disk 
`-sda1        8:1    1  14.8G  0 part 
mmcblk0     179:0    0   7.4G  0 disk 
|-mmcblk0p1 179:1       61.1M  0 part 
|-mmcblk0p2 179:2    0  61.1M  0 part 
`-mmcblk0p3 179:3    0   7.3G  0 part 

My USB drive is named "sda".

So if I try to mount the USB Drive with the command mount /sda/sda1 /mnt/usb/, I get this error:

mount: special device /sda/sda1 does not exist

Is there a way to mount this drive?

Thanks in advance for the help.

BR, Federico

2 Answers 2

4

Even if lsblk might discover the device (through /sys/), mount still requires a valid block device to mount from. If it wasn't created, either because the embedded device doesn't run a tool like udev or because the container's environment doesn't provide an adequately populated /dev/ directory like would be the host, one can still create it manually.

One should verify the block major/minor with the output of lsblk -o NAME,MAJ:MIN, let's suppose the relevant part displays:

# lsblk -o NAME,MAJ:MIN
NAME                MAJ:MIN
[...]
sda                   8:0  
`-sda1                8:1  
[...]

then the needed block device can be created with the previous information:

mknod /dev/sda1 b 8 1

which should now be able to be mounted with:

mount /dev/sda1 /mnt

As it's embedded, there might be further issues if the driver for the filesystem on this partition isn't built in kernel and for some reason it's not auto-loaded. So if that doesn't work on the first try, be sure to have the module explicitly loaded (eg: modprobe vfat) or builtin (recompile kernel...). Some filesystems wouldn't be so easy to use (eg: exfat didn't have direct kernel support in Linux 4.9 and would require FUSE).

3

There is no such directory as /sda.

What you actually want to do is mount /dev/sda1:

mount /dev/sda1 /mnt/usb/

1
  • 1
    I also tried you suggestion, but I gate the same error: mount: "special device /dev/sda1 does not exist"
    – Federico
    Commented Feb 28, 2022 at 16:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .