Once you have obtained Basic USB support, you now want to connect a storage (USB stick, USB harddisk, etc) device to your router. Using kmod-fs-ntfs only provides read support. This HowTo will show you how to obtain read/write support for NTFS volumes.
/dev, for example
fdiskoptional Required to autodetect the filesystem type when using the hotplug script.
There is nothing to configure! Note however, you can only mount a partition to an existing directory. You can create on with
mkdir, for example
mkdir -p /mnt/usb-ntfs.
To manually mount a partition:
ntfs-3g /dev/sda1 /mnt/usb-ntfs -o rw,sync
To auto mount a partition at startup (with hard drive plugged) edit the file /etc/rc.local :
sleep 3 ntfs-3g /dev/sda1 /mnt/usb-ntfs -o rw,sync exit 0
This forum post might be relevant if you already have built OpenWrt by yourself you have to rebuild the firmware with the Busybox's mount melper option enabled and reflash the new image. If you have not yet built OpenWrt once, Documentation - Building may help.
Now that you can get your volume to mount on command, the next step is mounting it when it's plugged in automatically.
To get our drive to mount on plugin, we utilize the hotplug system.
Create the following files as
(The script above comes from this blog post)
Now, whenever you plug in an NTFS USB disk, it should automatically mount. (Note that this will be a different path than
Below is a modified version of the script which should work fine even if you are using root file system using extroot. The original script tries to re-mount all the filesystems, including mtdblock* filesystems at boot which is not what we want.
Code is added to dismiss disks which can be managed by block_mount. It should be preferred if it supports the file system you are using but it has limited filesystem type support.
The mount binary seem to figure out what filesystem type it is trying to mount, therefore the code sections for checking this is removed. The script should be able to mount any supported filesystem. (so should it be in ntfs section?)
Some sensible mount options which should be suitable for both solid state and normal drives is also added. In addition, hdparm is called to set drive APM setting so drive can go to standby if not used (the correct setting may be drive dependent). The hd-idle does not seem to work on USB drives properly, but the APM setting is able to make the drive to use its internal logic if supported by the drive.
One other problem with the original script was related to unmounting. Once a drive is disconnected, it disappears from /dev therefore it can not be unmounted by giving the original /dev path (you would just get 'No such file or directory' error). Therefore the script finds where the drive was mounted and uses the mount point for unmounting.
The script was tested on OpenWrt Chaos Calmer 15.05 and requires blkid and hdparm to be installed. Modify the script to suit your needs. It currently mounts to /export