I use OpenWrt's USB storage page when I need an HDD, SSD, or flash drive for data, Samba/NAS, or a general file store. If the goal is extending the overlay to install more packages, this is not the whole extroot procedure; I keep the two goals separate.[25]
Warning: Formatting deletes data from the partition. Before running
mkfs.*, confirm the correct/dev/sda1or equivalent device and keep a separate backup.[25]
1. Install and verify USB drivers
Refresh package indexes, install storage support, and add UAS if the device needs it:[25]
| |
Connect the USB device and inspect it:[25]
| |
A usable result can show a root_hub with an xhci-mtk/ehci driver and a Class=Mass Storage line using usb-storage or usb-storage-uas. I want to see a driver name and no error in the USB chain; otherwise I revisit driver installation or reboot before trying again.[25]
2. Confirm the disk and partitions
Keep the drive connected and list block devices:[25]
| |
The result should include a disk such as /dev/sda or /dev/sdb, plus a partition if the disk is already partitioned:[25]
| |
Install the tools for UUID/filesystem information:[25]
| |
For example:[25]
| |
If no disk appears, recheck the USB driver and reboot. With multiple devices, /dev/sdb1, /dev/sdc1, and so on belong to later disks; never substitute the example /dev/sda1 for the actual output.[25]
3. Create a partition with gdisk
Do this only when the previous step shows no partition such as /dev/sda1:[25]
| |
Inside the interactive gdisk prompt:[25]
- Enter
nto create a partition.[25] - Keep the suggested defaults for number, starting sector, size, and Hex code when appropriate.[25]
- Enter
wto write the changes.[25] - Enter
Yto confirm.[25] - Record the new partition name for the format step.[25]
The documentation recommends a single partition for the following how-to; ? opens gdisk help.[25]
4. Install a filesystem and format it
The filesystem driver is required even when a partition was formatted elsewhere. For EXT4 on a USB hard disk:[25]
| |
For exFAT:[25]
| |
For F2FS on an SSD or thumb drive:[25]
| |
/dev/sda1 is only an example. Substitute the partition identified earlier and check the backup before formatting. For NTFS, use the appropriate NTFS driver/procedure rather than running mkfs.ext4 over existing data.[25]
5. Create an automount entry
Generate an fstab entry from the block device, enable the mount, and optionally enable filesystem checks at boot:[25]
| |
Reboot to test it, then inspect the configuration:[25]
| |
I want to see enabled='1', a target such as /mnt/sda1, and the expected UUID. Check the mount point:[25]
| |
A confirming result can include:[25]
| |
6. Optional NAS disk spindown
Option A: hdparm
hdparm stores a SATA timer on the disk itself; many older USB2 adapters do not support it, while some USB3 SATA adapters do. Install it and try a ten-minute timer:[25]
| |
If the command fails, the adapter or drive may not support this spindown command. 0 disables the timeout; 1–240 specify five-second multiples from 5 seconds to 20 minutes; 241–251 specify 30-minute units from 30 minutes to 5.5 hours.[25]
To apply it again at boot, the page gives this /etc/rc.local example:[25]
| |
Option B: hd-idle with LuCI
hd-idle is an OpenWrt service that sends a live spindown command when its idle counter reaches zero. Install its LuCI integration:[25]
| |
Open Services → HDD Idle to enable and configure it. For the CLI-only package:[25]
| |
Edit /etc/config/hd-idle, then enable and start the service:[25]
| |
The main hd-idle options are disk (default sda), enabled (default 0), idle_time_unit (default minutes), and idle_time_interval (default 10). Replace sda with the actual device identifier; do not assume the example /dev/sda2 matches the real layout.[25]
Final checks and limits
After mounting, read and write a non-critical test file and check logs if the disk disappears after reboot. The USB bus, filesystem, drive, power supply, and adapter all affect the result; this page configures storage but does not prove that every adapter supports UAS or spindown.[25]
Source
Original source: [Using storage devices]1, published/updated 2025-09-30.[25]
Sources
[25] https://openwrt.org/docs/guide-user/storage/usb-drives — OpenWrt Wiki: Using storage devices
https://openwrt.org/docs/guide-user/storage/usb-drives — Using storage devices. ↩︎


Góp Ý / Bình Luận / Đánh giá