Make a dir persistent

I created some folders in /mnt:


They are empty and they serve only to provide a mount point to my usb pendrives.

I noted that sometimes such folders still exist after the next reboot, sometimes not.
How can I make such folders persistent?
It is not a great issue. I added a series of mkdir /mnt/usbx in /etc/rc.local. But anyway I would like to understand why this happens.

/mnt should be rw, therefore you can create a directory there and it will be persistent across reboots.
Also /mnt should be part of overlay and not some tmpfs, which would lose all contents on reboot.
That being said, the only reason for a directory to go missing is that something deleted it, maybe after umount of the partition.
With a configuration like this you don't need to create the directory on boot.

uci add fstab mount
uci set fstab.@mount[-1].enabled='1'
uci set fstab.@mount[-1].uuid='D351-FB1D'
uci set fstab.@mount[-1].target='/mnt/usb1'
uci commit fstab
/etc/init.d/fstab restart
1 Like