OpenWRT – USB Storage Device

This article describes how to mount an USB storage device in OpenWRT.


Go to all articles of this series and the description of the test setup:

Test Setup
Test Setup

OpenWRT – Overview


To mount a USB device in OpenWRT follow these steps:

https://openwrt.org/docs/guide-user/storage/usb-drives

The software packages need to be installed on the device:

opkg install block-mount kmod-usb-storage usbutils libblkid gdisk

After the installation a new menu appears System --> Mount Points. If the menu is not displayed just reboot OpenWRT.

reboot

After the reboot login via LuCi.

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

Attach your USB storage device to your OpenWRT device.

Click Edit.

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

The mount point needs to be added via custom field. It is not listed in the drop down menu.

Configuration In LuCi

General Settings

Select your USB storage device from the drop down.

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

Click int to --cutom-- field

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

Enter the mount point of the USB storage device manually. The root directory is /mnt.

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

Click Save.

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

The USB storage device can get mounted by OpenWRT. Click Enabled and Save & Applythe changes.

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

On the CLI you can check if the USB storage device is mounted.


Gib mir gerne einen Kaffee ☕ aus!

Wenn dir meine Beiträge gefallen und geholfen haben, dann kannst du mir gerne einen Kaffee ☕ ausgeben.

PayPal Logo


liberapay.com/strobelstefan.de


Kaffee via Bitcoin

bc1qfuz93hw2fhdvfuxf6mlxlk8zdadvnktppkzqzj


root@OpenWrt:~# cd /mnt/
root@OpenWrt:/mnt# ls -lah
drwxr-xr-x    1 root     root           0 Nov 30 10:22 .
drwxr-xr-x    1 root     root           0 Nov 30 08:29 ..
drwxr-xr-x    2 root     root           0 Nov 30 10:22 sda1

Advanced Settings

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

Configuration on CLI

On the CLI the configuration looks as following:

root@OpenWrt:~# ls -l /dev/sd*
brw-------    1 root     root        8,   0 Nov 23 12:20 /dev/sda
brw-------    1 root     root        8,   1 Nov 23 12:20 /dev/sda1

root@OpenWrt:~# block info | grep "/dev/sd"
/dev/sda1: UUID="637E-0193" LABEL="usb-drive" TYPE="exfat"

root@OpenWrt:~# uci show fstab
fstab.@global[0]=global
fstab.@global[0].anon_swap='0'
fstab.@global[0].anon_mount='0'
fstab.@global[0].auto_swap='1'
fstab.@global[0].auto_mount='1'
fstab.@global[0].delay_root='5'
fstab.@global[0].check_fs='0'

# Generate a config entry for the fstab file:
root@OpenWrt:~# block detect | uci import fstab

# Now enable automount on that config entry:
root@OpenWrt:~# uci set fstab.@mount[-1].enabled='1'
root@OpenWrt:~# uci commit fstab

# uci show fstab
root@OpenWrt:~# uci show fstab
fstab.@global[0]=global
fstab.@global[0].anon_swap='0'
fstab.@global[0].anon_mount='0'
fstab.@global[0].auto_swap='1'
fstab.@global[0].auto_mount='1'
fstab.@global[0].delay_root='5'
fstab.@global[0].check_fs='0'
fstab.@mount[0]=mount
fstab.@mount[0].target='/mnt/sda1'
fstab.@mount[0].uuid='637E-0193'
fstab.@mount[0].enabled='1'

# Show mount point details
root@OpenWrt:~# ls -l /mnt/sda1
root@OpenWrt:~# block info
/dev/mtdblock13: UUID="9b0b81c6-8dfd6cb8-6b633c0f-b2292799" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock14: MOUNT="/overlay" TYPE="jffs2"
/dev/mtdblock15: TYPE="jffs2"
/dev/sda1: UUID="637E-0193" LABEL="usb-drive" TYPE="exfat"

# Restart service fstab
root@OpenWrt:~# service fstab boot

Prepare USB Storage

Start disk utility program

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

Click on Delete

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

Select ExFAT and click on Delete

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

Eject the storage device.

OpenWRT - USB Storage Device
OpenWRT – USB Storage Device

Attach the usb storage device to OpenWRT and follow the steps described above.


See all articles of this series …

stefanstrobel - Logo

… on strobelstefan.de
Overview of all OpenWRT Articles/

© Logo material is licensed under CC0 Codeberg and the Codeberg Logo are trademarks of Codeberg e.V

… on codeberg.org
see manual on codeberg.org


Gib mir gerne einen Kaffee ☕ aus!

Wenn dir meine Beiträge gefallen und geholfen haben, dann kannst du mir gerne einen Kaffee ☕ ausgeben.

PayPal Logo


liberapay.com/strobelstefan.de


Kaffee via Bitcoin

bc1qfuz93hw2fhdvfuxf6mlxlk8zdadvnktppkzqzj


Source:
– https://openwrt.org/
– Official OpenWRT Logo – https://openwrt.org/_media/docs/guide-graphic-designer/openwrt-logo-usage-guidelines.pdf

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert