In our application, we use USBs to store extra user data, and also to sometimes to transfer data. The current implementation inside of Torizon v7.2 seems to sometimes not delete the previous folders it created on reboot (power loss) and instead keeps creating new folders to mount USBs to.
I have done a little bit of research, and it seems like Torizon is using Udisks2 to do their auto-mounting, and its a somewhat common problem for it to change the mounting location of USBs over time. I tried disabling Udisks2, and adding a u-dev rule for adding usbs on another board (we had used this before on our solution before moving to Torizon), but the rule seems to not be triggering on bootup.
Is there any clear guidance on how to solve this issue? I don’t mind editing our logic to search additional folders to find where the USB is mounted, but it seems to occur between 10-20% of reboots, and over a couple years I am imaging hundreds of folders being created, which isn’t ideal.
I am not sure why the u-dev rule we have used before isn’t triggering on reboot, and if I perhaps missed a setting. The rule works when plugging in a USB after boot, but is not triggering on USBs that are present on bootup. The rule (which just calls a script that handles mounting the USB), is shown below. The script is a bit heavy handed and proceeds to delete folders that exist where I normally mount, but this is ok in our application, as long as it makes sure the USB is mounted to the correct location.
ENV{ID_FS_LABEL_ENC}==“?*”, ACTION==“add”, SUBSYSTEMS==“usb”,
RUN+=“/config/systemd/udev-automounter.sh %k”ENV{ID_FS_LABEL_ENC}==“?*”, ACTION==“remove”, SUBSYSTEMS==“usb”,
RUN+=“/config/systemd/udev-autounmounter.sh %k”ENV{ID_FS_UUID}==“?*”, ACTION==“add”, SUBSYSTEMS==“usb”,
RUN+=“/config/systemd/udev-automounter.sh %k”ENV{ID_FS_UUID}==“?*”, ACTION==“remove”, SUBSYSTEMS==“usb”,
RUN+=“/config/systemd/udev-autounmounter.sh %k”
Also attached is the example file proliferation from udisks2 after about 10 reboots (in our case, reboots are from power loss to the board)