新装openwrt扩容

这几天都在折腾家里的openwrt,烦的很,根本原因就是因为空间占用:

本来就容量告急,因为是去年年底咸鱼卖家直接给烧录的固件,8G的tf卡,就划分1G,然后里面整了一堆插件,加上缓存,就占到只剩几MB了,我还手贱点了一下Adguardhome的升级版本,报错提示空间不足,然后顺带在跑程序也被影响了,本着遇事不决重启系统的原则,我重启了一下然后,大概又是因为空间不够,什么配置都加载不出来😡

WDNMD,整个网络都宕机了,前天还在看李永乐老师讲墨菲定律的视频,虽然没什么直接联系,但是这玩意做主路由还是太草率了,重新刷个固件当旁路网关用吧。。

用的是这个固件 原始后台ip 192.168.11.1 密码password

树莓派官网的烧录工具还是好用,直接给tf卡格式化完,写入自定义固件就完事了


省去一些痛苦的试错经历


用笔记本网口直连路由的LAN口,设置ip为192.168.11.XXX子网下,就能进去192.168.11.1后台了

设置机器的ip与主路由同网段下,关闭DHCP,关闭桥接,把机器连上主路由,然后笔记本再连wifi,ssh连上机器

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
     _________
    /        /\      _    ___ ___  ___
   /  LE    /  \    | |  | __|   \| __|
  /    DE  /    \   | |__| _|| |) | _|
 /________/  LE  \  |____|___|___/|___|
 \        \   DE /
  \    LE  \    /  ------------------------------------
   \  DE    \  /    OpenWrt SNAPSHOT, r4494-9c0c92a54
    \________\/    ------------------------------------


# root @ OpenWrt in ~ [11:39:01]
$ df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root              1011.8M    673.4M    322.4M  68% /
tmpfs                     1.9G     18.6M      1.9G   1% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mmcblk0p1           49.2M     12.3M     35.9M  26% /mnt/mmcblk0p1

# root @ OpenWrt in ~ [11:49:18] C:1
$ fdisk -l
Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5452574f

Device         Boot  Start     End Sectors Size Id Type
/dev/mmcblk0p1 *     65536  167935  102400  50M 83 Linux
/dev/mmcblk0p2      196608 2301951 2105344   1G 83 Linux

7.4G的tf卡,只用了1G,然后根目录的使用已经68%了。。

that’s the point

进入后台web 系统/磁盘管理,修改磁盘

修改磁盘

计算好要替换的空间大小,创建,然后格式化成ext4格式

创建分区

系统/挂载点 生成配置

生成配置

修改下方新出现的挂载点 启动、作为根文件系统使用

修改挂载点

保存&应用!

然后回到ssh依次输入命令

1
2
3
4
5
6
7
mkdir -p /tmp/introot
mkdir -p /tmp/extroot
mount --bind / /tmp/introot
mount /dev/mmcblk0p3 /tmp/extroot
tar -C /tmp/introot -cvf - . | tar -C /tmp/extroot -xf -
umount /tmp/introot
umount /tmp/extroot

然后reboot -> 重连ssh,检查一下

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
     _________
    /        /\      _    ___ ___  ___
   /  LE    /  \    | |  | __|   \| __|
  /    DE  /    \   | |__| _|| |) | _|
 /________/  LE  \  |____|___|___/|___|
 \        \   DE /
  \    LE  \    /  -------------------------------------------
   \  DE    \  /    OpenWrt SNAPSHOT, r4494-9c0c92a54
    \________\/    -------------------------------------------


# root @ OpenWrt in ~ [13:37:21]
$ df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root              1011.8M    673.4M    322.4M  68% /rom
tmpfs                     1.9G     16.0M      1.9G   1% /tmp
/dev/mmcblk0p3            2.0G    672.2M      1.2G  35% /
tmpfs                   512.0K         0    512.0K   0% /dev

# root @ OpenWrt in ~ [14:17:58]
$ fdisk -l
Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x81fd89f3

Device         Boot   Start     End Sectors  Size Id Type
/dev/mmcblk0p1 *      65536  167935  102400   50M 83 Linux
/dev/mmcblk0p2       196608 2301951 2105344    1G 83 Linux
/dev/mmcblk0p3      2301952 6709248 4407297  2.1G 83 Linux

漂亮,收工

Licensed under CC BY-NC-SA 4.0
this is the way