How to REmount USB drive on BBB automatically?

BBB/Debian 10:

I followed BeagleBone Black Add USB Thumb Drive As Extra Storage in Ubuntu Server | Linux Propaganda to automatically mount a USB drive to BBB successfully, as USB2 (instead of USB in the example, USB is in use for some reason I don’t know),

Anyway, I can access my FAT32 drive, until I remove it and plug it back in, which I will not be access its file system anymore until I reboot BBB

Any way to handle it properly? (According to the link above, it is supposedly mounted automatically…)

Did you “eject” it, or did you just rip it out?

if you ejected it, just run: “sudo mount -a” to get it back…

Regards,

Just rip it out when file is written to it, which I am simulating what would happen in the field. Anyway to recover?

Sorry, i’m not going to try making that work! :wink:

Add a button for “eject” with some sorta led, otherwise you will having lots of fun with corruption…

Regards,

OK, understood your point

To eject it, I googled and tried to see how to get it done properly…

I can see the thumb drive with lsblk command
debian@beaglebone:/media/USB2$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 1.9G 0 disk
mqsda1 8:1 1 1.9G 0 part /media/USB2
mmcblk1 179:0 0 3.6G 0 disk
mqmmcblk1p1 179:1 0 3.6G 0 part /
mmcblk1boot0 179:8 0 4M 1 disk
mmcblk1boot1 179:16 0 4M 1 disk

After i installed “eject:”, i still failed to eject (umount)
debian@beaglebone:/media/USB2$ sudo eject /media/USB2
umount: /media/USB2: target is busy.
eject: unmount of `/media/USB2’ failed

i also tried umount…

debian@beaglebone:/media/USB2$ sudo umount /media/USB2
umount: /media/USB2: target is busy.

Could you point out my problem? Thanks!

Step 1, figure out what is actively writing to the drive and shut that down, before you eject it…

Regards,

update: the problem is user error on my end: I issued mount/umount command while inside \media\USB2 directory

Take a look at this project for auto-mounting:

Regards,

Thank you very much for your time!