[fstab] Using wildcard?

I've configured fstab to mount USB memory sticks as 'sda1', but some USB sticks lack a partition table and will present themselves as device 'sda'. Instead of duplicating all possible name combinations, is it possible to use a wildcard in the device name?

fstab.usb=mount
fstab.usb.enabled='1'
fstab.usb.target='/mnt/sda1'
fstab.usb.options='utf8,ro'
fstab.usb.device='/dev/sda1'

Would it be possible to write something like this?

fstab.usb.device='/dev/sda*'

I can't use the 'anon' mount as we have to pass the 'utf8' option for supporting file names with non-ASCII characters. It seems like the 'options' parameter is not implemented for 'anon'.

1 Like

No, but you can use the disk label or UUID as stable/persistent identifiers:
https://openwrt.org/docs/guide-user/storage/fstab#the_mount_sections

2 Likes

UUID or disk label are no valid option for me as I can't know what USB drive my customer will use.

check if hotplug can help https://openwrt.org/docs/guide-user/base-system/hotplug

1 Like