Mount disk on OpenWRT
Prerequisites
- Sufficient free USB port and a supported storage device (e.g., USB flash drive, SSD)
- SSH or terminal access to your device
Install required packages:
opkg update
opkg install block-mount e2fsprogs kmod-usb-storage kmod-fs-ext4
Install
1. Identify your drive:
ls -al /dev/sd*
2. (Optional) Format the drive (WARNING: erases all data!):
mkfs.ext4 /dev/sdb
3. Create the mount point:
mkdir -p /mnt/data
4. Mount the drive manually (for testing):
mount /dev/sdb /mnt/data
df -h /mnt/data
5. Configure automount at boot:
Detect and import block devices:
block detect | uci import fstab
Set the mount point in fstab:
uci set fstab.@mount[-1].enabled='1'
uci set fstab.@mount[-1].target='/mnt/data'
uci commit fstab
Mount all drives now and on future boots:
/etc/init.d/fstab boot
Debug
Check if the drive is mounted:
df -h /mnt/data