NAS (Network Attached Storage)

Using OpenWrt for NAS usually involves a device with a single ethernet port and some kind of mass storage.

After Basic configuration of your device, as a typical NAS user, you may need to configure your device to obtain an IP number from some other router and then just sit there and be a NAS. This is similar to how we configure a dumb AP using managed services.

Do the following from the command line as root to disable unnecessary services (an alternative is of course to build the image without these components by removing them during menuconfig):

  1. Disable dnsmasq
      service dnsmasq disable
      service dnsmasq stop
  2. Disable odhcpd
      service odhcpd disable
      service odhcpd stop
  3. Disable firewall (unless you feel it's a good idea to protect your NAS from the local network)
      service firewall disable
      service firewall stop
  4. Edit /etc/config/system to reflect your timezone, or all timestamps will be in UTC. This matters for NAS storage. For example I set:
    option timezone 'CET-1CEST,M3.5.0,M10.5.0/3'
  5. Set up NTP servers that your device will obtain time from. If you are using another instance of OpenWrt as your router it can easily be used for providing NTP inside your own network, for example.
  6. Type poweroff to shut down the system.
  7. Plug it into some ethernet port on your LAN that will provide DHCP for devices, and it should happily connect to that network and come up. You need to figure out the IP address but usually you can check what devices have appeared on your network in your main DHCP server/router.

You will probably want to install some services for managing your as an OpenWrt NAS. This would be a typical set of packages:

opkg update
opkg install luci ksmbd-server luci-app-ksmbd kmod-usb-storage block-mount e2fsprogs

This will enable the LuCI web UI, the ksmbd file server and the ''block'' tool for block storage on USB as well as the necessary packages for handling USB mass storage.

If you have an empty disk attached to your NAS, partition this free space like this:

  1. Log in to NAS or use the console if you have one.
  2. fdisk /dev/sda (NOTICE fdisk can only handle up to 2GB disks, for larger storage you need a GPT partition table, then use gdisk instead)
  3. press n, p ENTER, ENTER, ENTER, ENTER, w to create /dev/sda1
  4. mkfs.ext4 /dev/sda1
  5. Use the ''block'' tool to set up the /dev/sda1 partion for mounting:
    block detect | uci import fstab
    uci set fstab.@mount[0].enabled='1'
    uci commit fstab
  6. You can verify that we set up /dev/sda1 for mounting with cat /etc/config/fstab
  7. Reboot
  8. When the device comes up df should show you /dev/sda1 mounted as /mnt/sda1
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2026/02/17 09:54
  • by linus