question to block mount/umount
Daniel Golle
daniel at makrotopia.org
Wed Dec 14 06:06:49 PST 2022
On Wed, Dec 14, 2022 at 02:45:02PM +0100, e9hack wrote:
> Hi,
>
> I'm build OpenWrt with additional sub directories in /mnt. /etc/config/fstab contains an entry, to mount an usb drive to /mnt/1. If I execute 'block umount', the usb drive will be unmount and the subdirectory 1 in /mnt will be removed. Removing of the sub directory, is this the expected behaviour?
If the directoty is empty, then yes, this is the expected behavior.
See
https://git.openwrt.org/?p=project/fstools.git;a=blob;f=block.c;h=4b45200ad3812f5b79bda5d53c72a13ca5e92636;hb=HEAD#l1225
In case you'd like to keep it, simply have a 0 byte file in the
directory (ie. `touch /mnt/1/.keep`), this will prevent rmdir()
from succeeding and will result in the directory being kept after
'block umount'.
More information about the openwrt-devel
mailing list