I want to use samba public sharing (in home network) with auto-mounting USB-HDD like in LEDE
and auto-stop USB-HDD after 10 minutes inactive\unusing USB-HDD. Also need safe remove USB-HDD drive.
My USB-HDD has NTFS filesystem with russian letters in filenames.
I have already installed following packages:
I did automount by instructions:
but it isn't work.
after reboot router or unplug\plug USB-HDD, "option target '/mnt/sdb1'" changing to "option target '/mnt/sda1'" in "block detect" output
and vice versa every times:
(output 'block detect' command every times diffrent with /etc/config/fstab configfile what a make before)
It's been a while since I've tried to auto mount ntfs and I don't know if anything has changed, but in my experience it just wasn't possible with the usual instructions, you can use this line in /etc/rc.local (system>startup in luci) to mount at boot -
root@OpenWrt:~# cat /etc/rc.local
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
umount /mnt/sdb1
ntfs-3g /dev/sdb1 /mnt/sdb1 -o rw,async
yes, it working when I reboot router.
but when I detach USB-HDD and attach again, automount mounting device in readonly mode, like this:
mount /mnt/sdb1
root@OpenWrt:~# touch /mnt/sdb1/qweqwe
touch: /mnt/sdb1/qweqwe: Read-only file system
Linux will assign a different device name like "/dev/sd_" each time you plug in a drive, that is expected behaviour. And "block detect" is giving you info about where is the drive at that moment.
Thats is why you should use UUIDs instead of device names at fstab.
if I mount through: mount /dev/sdb1
i have readonly.
if I mount though: ntfs-3g /dev/sdb1 /mnt/sdb1 -o rw,async
i have read-write filesystem.
This is automount parameters of mount:
root@OpenWrt:~# mount | grep mnt
/dev/sdc1 on /mnt/sdb1 type ntfs (ro,relatime,uid=0,gid=0,fmask=0177,dmask=077,nls=default,errors=continue,mft_zone_multiplier=1)
Following parameters is manually mount filesystem. It's good paramters. =)
How to learn the automount system mount filesystem with "good parameters" ?
root@OpenWrt:~# mount | grep mnt
/dev/sdc1 on /mnt/sdb1 type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
PS.
changing fstype in /etc/config/fstab doesn't help:
If you install block-mount you should see Mount Points under System in Luci, in Mount Points you should see Mounted File Systems and your drive should be listed there with an option to Unmount.