OpenWRT软路由部署历程学习笔记
清华镜像源
sed -i 's/downloads.openwrt.org/mirrors.tuna.tsinghua.edu.cn\/openwrt/g' /etc/opkg/distfeeds.conf
opkg update
汉化
opkg install luci-i18n-base-zh-cn
----------------------------------------------------------------------------------------------------------
opkg update
# 一键安装所有简体中文i18n翻译包
opkg install luci-i18n-base-zh-cn luci-i18n-firewall-zh-cn luci-i18n-network-zh-cn luci-i18n-diagnostics-zh-cn luci-i18n-statistics-zh-cn luci-i18n-ddns-zh-cn luci-i18n-upnp-zh-cn luci-i18n-qos-zh-cn luci-i18n-samba-zh-cn luci-i18n-sqm-zh-cn
--------------------------------------------------------------------------------------------------------
区分WAL LAN口
cat /etc/config/network
时间同步服务器地址
ntp.aliyun.com
常用工具
opkg install xxx
luci-app-sqm(智能限速)
luci-app-statistics(流量监控)
luci-app-adguardhome(去广告)
SSH链接出现全是@需要使用以下命令删除密钥
ssh-keygen -R 192.168.2.1
安装istore
apk update || opkg update || exit 1
cd /tmp
wget https://github.com/linkease/openwrt-app-actions/raw/main/applications/luci-app-systools/root/usr/share/systools/istore-reinstall.run
chmod 755 istore-reinstall.run
./istore-reinstall.run
istore 如果下载不了则修改github目标host地址
vim /etc/hosts
输入小写 o 命令:在下一行追加 :
140.82.114.3 github.com
:wq
20260623
新装openwrt-23.05.5-x86-64-generic-ext4-combined-efi.img.gz
rufus写入之后开机直接ssh并未报错也并未提示源下载失败
opkg update
opkg install e2fsprogs parted fdisk lsblk
# 1. 更新软件源索引
opkg update
# 2. 安装ext4修复、resize扩容核心工具包
opkg install e2fsprogs
# 3. 安装分区管理fdisk
opkg install fdisk
# 4. 安装GPT分区专用parted(适配你SSD的GPT分区表)
opkg install parted
# 5. 补充磁盘查看lsblk(可选)
opkg install lsblk
验证parted -v、fdisk -v
提示-ash: resize2fs: not found 则意味着e2fsprogs安装失败
opkg update
opkg install --force-reinstall e2fsprogs
resize2fs -v
扩容挣扎之路
df -h
lsblk
完整扩容分步命令(适配sda2为根分区,严格按顺序执行)
1. 先在网页后台卸载挂载
进入 系统 → 挂载点 ,找到 /overlay 对应的 /dev/sda2 ,点击卸载;
SSH手动兜底卸载:
umount /dev/sda2
2. 进入parted拉伸sda2分区到磁盘末尾
parted /dev/sda
# 把2号分区终点拉满整块磁盘100%位置
resizepart 2 100%
# 保存退出
quit
------------------------从以下内容开始无法操作,运行状态下无法扩容推荐离线版U盘启动进行扩容-----------------------------------------------------
3. 校验文件系统完整性 + 扩容ext4容量
# 强制检查修复文件系统
e2fsck -f /dev/sda2
# 让ext4文件系统填满刚扩展的分区
resize2fs /dev/sda2
4. 重新挂载分区生效
mount /dev/sda2 /overlay
验证结果
执行 df -h ,查看 /overlay 挂载点容量,会从原来的109MB扩容到整块7.38G SSD全部容量,Windows里看到的7.26G未分配空间完全并入系统。
⚠️ 重要禁忌
1. 绝对不要修改/删除sda1、sda3这两个引导分区,会直接导致软路由无法开机;
2. 必须卸载 /overlay 后再执行 resizepart ,挂载状态修改分区会造成文件损坏变砖;
3. 不要再去Windows磁盘管理里操作这片未分配空间,会破坏GPT分区表。
----------------------------------------------------------------结束,以下计划用diskGenius或者离线U盘扩容--------------------------------------------------------------------------

浙公网安备 33010602011771号