[Solved] Auto mount USB storage

Is there any way to mount USB storage device automatically inside /mnt/sdXY when pluged-in. Without rebooting or without going to shh.

1 Like

Sure you can.
Assuming that you already have the basic USN storage device mounting working, the automatics is about editing /etc/config/fstab according to your wishes (mounting any device, mounting just one known device etc.)

https://lede-project.org/docs/user-guide/fstab_configuration

I use a simple fstab that enables also anonymous mounting = any drive.

root@LEDE:~# cat /etc/config/fstab
config 'global'
        option anon_swap  '0'
        option anon_mount '1'
        option auto_swap  '1'
        option auto_mount '1'
        option delay_root '0'
        option check_fs   '0'

## use 'block detect' to find out uuid, if you want device specific mount.
## anon_mount enables the automatic mounting of /dev/sdXy to /mnt/sdXy

If you want a specific mount point for a certain drive, you need to use UUID to define it.
Something like

config 'mount'
        option  target  '/mnt/sda1'
        option  uuid    '1E33-5319'
        option  enabled '1'

mine is

# cat /etc/config/fstab 

config global
	option anon_swap '0'
	option auto_swap '1'
	option auto_mount '1'
	option delay_root '5'
	option anon_mount '1'
	option check_fs '1'

config mount
	option uuid 'fc4ab2ae-577c-46ea-8073-5adfc2324279'
	option enabled '1'
	option target '/mnt/nashdd'
	option fstype 'ext4'
	option enabled_fsck '1'

I have use luci menu to configure this, yes worked. Thanks bro

1 Like