Thanks to your response though, I tweaked my search parameters in here searching for USB rule and located this message thread that didn’t turn up with previous USB searches.
I need to hack an fstab file and copy it in via Dockerfile.
Thanks again. After some sleep I just needed a nudge in the proper direction to find the answer.
Roland
When I cold boot the board with thumb drive installed, it wasn’t showing anything in /media. After the container got started, I could see entries in /media at the board level (via different SSH into board.)
I want to research more this automount.rules concept because I think that would be the better solution. The fstab entry appears to have a “known” device name/label, but I haven’t dug deep. Too many things competing for my attention this morning.
Just to round out this discussion, what is presented in the previous link is a partial solution. If you have only one thumb drive, it will work. They need to be in place at power up though . . . I haven’t tested dynamically adding thumb drive.
You are limited to 2.
If you have a keyboard connected that has a pair of USB ports so your mouse doesn’t have to take the other one on the carrier board, you can get two.
The default device tree allows for /sda1 and /sdb1. Yes, someone who is familiar with low level Linux device trees can probably tweak that to allow as many as they want.
On the board itself, after you log in as torizon
sudo nano /etc/fstab
/dev/sda1 /media/usbhd auto relatime,nofail,utf8,uid=torizon,gid=torizon,umask=002 0 0
/dev/sdb1 /media/usbhd2 auto relatime,nofail,utf8,uid=torizon,gid=torizon,umask=002 0 0
Exit and save. Exit out of your SSH session. Touch the reset button.
Now load your container where you add the following: -v /media:/media/torizon
The default mount on the board itself isn’t consistent with Linux. It mounds them directly under /media. If you want to develop and test your Linux code in a VM, your USB media will be mounted under /media/your-username/. The above keeps that mounting consistent.
Hello, I see you’ve already found the fstab solution I suggested on a previous post.
One thing I wanted to add that I didn’t see mentioned already is, will the USB device here be dynamically removed and reinserted, while the container is running?
If yes you might want to consider the bind-propagation property of Docker, instead of a normal bind mount. Otherwise if you remove the USB or it gets unmounted, these changes will not be reflected properly inside the container with a normal bind-mount.
No matter which one I tried, when you pull the thumb drive out it’s still there in the container because it appears in fstab.
The only way to solve that problem is to dig into “rules” creating automount and autounmount rules. The fstab entries simply stay. They automount, but they don’t auto dismount, propagation or not.
When you pull the thumb drive out of a box running Ubuntu native, the entry goes away in /media. This stops applications that search /media for export media from attempting to use it. What you have shown requires an application put in extra effort to figure out if media is really there.
That was my point.
/media/usbhd is there forever once entry is in fstab but that doesn’t mean it is a valid mount point.