Article directory
Preliminary knowledge
OpenWrt system firmware classification
-
EXT4 firmware
The firmware package name contains
ext4
keywords, you can refer to固件分类关键字示意图
the picture. This type of firmware hard disk space is divided as follows: -
SQUASHFS firmware
Firmware package names contain
squashfs
keywords, also refer to固件分类关键字示意图
pictures. This type of firmware hard disk space is divided as follows:
Schematic diagram of firmware classification keywords:
EXT4 firmware expansion method
New partition expansion
Create a new partition and mount the root directory to the new partition; (recommended)
Create a new partition in the unformatted area, then copy all the contents of the original system file partition to the new partition, and finally change the default mount point of the system root directory to the new partition.
Steps
-
View current disk information
fdisk -l
-
create new partition
# 注意fdisk后参数是磁盘名称,是要根据实际情况填写 fdisk /dev/mmcblk0 # 输入p查看分区情况 p # 输入n创建新分区 n # 选择p,primary分区类型 p # 选择分区序号,根据实际情况填写了,一般默认即可 # 输入分区起始位置,需要大于红色下划线数字 # 输入要创建的分区大小,例如要创建3GB,可以输入+3G即可 # 最后输入w写入磁盘
-
Check partition effect
fdisk -l
-
format partition
# mkfs.ext4后参数为新分区名称 mkfs.ext4 /dev/mmcblk0p3
-
Log in to openwrt on the web page, select the system mount point, and select Add
-
Select the newly created partition and mount it to the root directory, save and apply
-
The command to copy
根目录准备
the region is as followsmkdir -p /tmp/introot mkdir -p /tmp/extroot mount --bind / /tmp/introot # mount命令后参数为新分区,该博客中的例子为/dev/mmcblk0p3 mount /dev/sda1 /tmp/extroot tar -C /tmp/introot -cvf - . | tar -C /tmp/extroot -xf - umount /tmp/introot umount /tmp/extroot
-
Paste and execute the above command on the command line
-
If the firmware contains
efi
the keyword, you need to refer toEFI引导固件的额外操作
the chapter to perform additional steps (optional: only if the firmware contains the efi keyword) -
Restart the soft router
reboot
direct expansion
Directly expand the original root partition, as shown in the figure below:
Steps
-
Delete the old partition (you need to remember the disk start position of the old partition, as shown in the underlined position), and create a new partition
# 注意fdisk后参数是磁盘名称,是要根据实际情况填写 fdisk /dev/mmcblk0 # 删除第2个分区,输入d d # 选择第2个分区,根据实际情况填写 2 # 输入n创建新分区 n # 选择primary分区类型 p # 分区编号选择2,一般默认即可 2 # 输入分区起始位置,该位置要与删除分区的起始位置相同 # 输入创建分区大小,例如+3G # 不要删除标识!不要删除标识!不要删除标识!选择n! n # 输入w写入磁盘 w
-
Check partition effect
fdisk -l
-
Set loop device
losetup /dev/loop0 /dev/mmcblk0p2
-
expand disk space
resize2fs -f /dev/loop0
-
If the firmware contains
efi
the keyword, you need to refer toEFI引导固件的额外操作
the chapter to perform additional steps (optional: only if the firmware contains the efi keyword) -
Restart the soft router
reboot
SQUASHFS firmware expansion method
New partition expansion
Since the SQUASHFS firmware will automatically create rom space after installation, it can be expanded directly.
direct expansion
The direct expansion method is the same as the ext4 firmware expansion method, you can refer to the above steps. Similarly, x86 device efi firmware needs to be distinguished. Special operations are also mentioned above, you can refer to them.
Extra Actions for EFI Boot Firmware
-
View partition ID
blkid
-
modify system boot
# 编辑grub.cf文件 vi /boot/grub/grub.cfg # 将下划线的两个分区ID修改成新分区的UUID即可
-
save document
# 输入:wq即可,或者Shift + ZZ快捷键保存均可