🧠 OpenWrt Router – Extended Capabilities with USB Drive

🏷️ Suggested blog slug: openwrt-git-automation-setup

πŸ“— Blog Entry: Format and Mount a USB Drive as ext4 on OpenWrt πŸš€πŸ§±πŸ’½

If you're using a router like the Linksys WRT3200ACM with OpenWrt, adding a USB drive unlocks powerful new features: Git repositories, scripting, backups, and more! πŸ§ πŸ’‘

This post will show you how to safely format a USB stick to ext4, mount it, and prepare it for automation or data storage. Perfect for developers and makers! βš™οΈπŸ‘¨β€πŸ’»

🧼 Step 1: Clean the USB (Optional but Recommended)

To avoid legacy partition issues, clear the drive on your PC first:

πŸ”· On Windows:

diskpart
list disk
select disk X       # Replace X with the USB disk number
clean
exit

Eject safely and plug it into your OpenWrt router.


πŸ”Œ Step 2: Plug in and SSH into OpenWrt

ssh root@192.168.1.1

🧰 Step 3: Install Required Tools

opkg update
opkg install kmod-usb-storage block-mount e2fsprogs fdisk
  • Supports USB mounting, ext4 formatting, and partitioning.

🧱 Step 4: Create and Format the Partition

Check your USB is detected:

ls /dev/sd*

Then partition and format:

fdisk /dev/sda
# Use: d (delete), n (new), p (primary), enter/enter, w (write)

mkfs.ext4 -L openwrt_usb /dev/sda1

πŸ“‚ Step 5: Mount the USB Drive

mkdir -p /mnt/usb
mount /dev/sda1 /mnt/usb
df -h

βœ… You should see /mnt/usb with your drive’s capacity listed.


πŸ” Optional: Mount Automatically on Boot

block detect | uci import fstab
block mount

Now your USB drive is ready to hold Git projects, scripts, backups, or anything else your OpenWrt system needs! πŸ“¦πŸ§ βœ¨

🧬 Step 6 Clone Your Private Repo via SSH

cd /mnt/usb/projects/your-repo
git clone git@github.com:your-username/your-repo.git

πŸ“ Conclusion

With your USB drive formatted and mounted, you can now leverage OpenWrt's capabilities for development, automation, and data management. Whether you're running scripts, managing backups, or hosting Git repositories, the possibilities are endless! πŸš€πŸ’»