1.查看当前磁盘信息
df-h
root@BleachWrt:~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 310.3M 310.3M 0 100% /rom
tmpfs 1.9G 22.2M 1.8G 1% /tmp
/dev/loop0 711.9M 81.0M 630.9M 11% /overlay
overlayfs:/overlay 711.9M 81.0M 630.9M 11% /
/dev/mmcblk0p1 63.9M 19.6M 44.2M 31% /boot
tmpfs 512.0K 0 512.0K 0% /dev
cgroup 1.9G 0 1.9G 0% /sys/fs/cgroup
overlayfs:/overlay 711.9M 81.0M 630.9M 11% /opt/docker
2.利用空余存储新建分区
fdisk /dev/mmcblk0
:修改为对应的硬盘名称
root@BleachWrt:~# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.
Command (m for help): p <=====查看当前分区信息
Disk /dev/mmcblk0: 119.08 GiB, 127865454592 bytes, 249737216 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 * 8192 139263 131072 64M c W95 FAT32 (LBA)
/dev/mmcblk0p2 147456 2244607 2097152 1G 83 Linux
^
(分区2的end位数值)
Command (m for help): n <=====新建分区
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p): p <=====设置新建分区为主分区
Partition number (3,4, default 3): 3 <=====设置新建分区号为3
First sector (2048-249737215, default 2048): 2244608 <=====此数值需大于分区2的end位数值
Last sector, +/-sectors or +/-size{K,M,G,T,P}(2244608-249737215, default 249737215):<=回车
Created a new partition 3 of type 'Linux' and of size 118 GiB.
Command (m for help): p <=====查看当前分区信息
Disk /dev/mmcblk0: 119.08 GiB, 127865454592 bytes, 249737216 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 * 8192 139263 131072 64M c W95 FAT32 (LBA)
/dev/mmcblk0p2 147456 2244607 2097152 1G 83 Linux
/dev/mmcblk0p3 2244608 249737215 247492608 118G 83 Linux
Command (m for help): w <=====保存分区信息
The partition table has been altered.
Syncing disks.
3.格式化新建的分区
mkfs.ext4 /dev/mmcblk0p3
:执行完出现done
即格式化成功
root@BleachWrt:~# mkfs.ext4 /dev/mmcblk0p3
mke2fs 1.47.0 (5-Feb-2023)
Found a dos partition table in /dev/mmcblk0p3
Proceed anyway? (y,N) y
Discarding device blocks: done
Creating filesystem with 30936576 4k blocks and 7741440 inodes
Filesystem UUID: 49694d4a-62db-4365-82dd-1005604e63d5
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (131072 blocks): done
Writing superblocks and filesystem accounting information: done
4.挂载新分区,并将overlay分区的配置文件导入新分区
mkdir -p /mnt/mmcblk0p3
:创建用于挂载的目录
mount /dev/mmcblk0p3 /mnt/mmcblk0p3/
:挂载新分区至挂载目录
ls /overlay/
:查看/overlay/
分区下的内容
root@BleachWrt:~# ls /overlay/
upper work
cp /overlay/* /mnt/mmcblk0p3/
:将/overlay/
分区下的内容复制到挂载目录
root@BleachWrt:~# ls /mnt/mmcblk0p3/
lost+found upper work
5.打开web端,创建挂载点
在“UUID”中选择新建的分区,挂载点选择“作为外部overlay(/overlay)使用”,勾选“启用此挂载点”
6.回到终端执行reboot
命令
reboot
:重启电脑使配置生效