USB-connections are becoming common on most routers today. A popular usage scenario is connecting a USB storage device like a USB-pen or hard-drive and share the content on your LAN. This recipe will guide you through how this can easily be set-up using the Luci web-interface.

Install dependencies

You will find detailed walk throughs for USB-storage and Samba respectively. At a minimum, you will need to install the packages kmod-usb-storage, block-mount, samba36-server and luci-app-samba. In addition you will need support for the file system you format the USB device with. For ext file-systems install kmod-fs-ext4, for btrfs install kmod-fs-btrfs. Avoid using ntfs from Microsoft, it lacks a couple of important features for file-systems. But if you still want to use it, install ntfs-3g in order to have read & write access.

Mount your USB drive

Whether it is a USB pen or a hard-drive. Simply plug it in the USB port, and it should show be automatically detected by OpenWrt (if you ssh into the router you will typically find a new entry /dev/sda for the device, and /dev/sda1 for it’s first partition). Now go to the Mount points tab under System in the Luci web-interface. You will find your USB storage device listed already as show below. If you have formatted your drive with the Ext file system, all you need is to tick Enable and then Save & Apply.  Mount points is only visible if dependencies are already installed

In my case I used the btrfs filesystem due to it’s advanced functionalities. In this case you will need to change the file system. Choose Edit, and you will be able to revise like this:

Share the drive on your local network

We will only show how to do simply sharing here. Samba supports advanced access policies, but this recipe is meant for the most common use case. Please consult the Samba howto for a more thorough walk-through.

https://openwrt.org/docs/guide-user/services/nas/usb-storage-samba-webinterface

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *