一、x86的ext4 efi版本扩容步骤
1、安装必要软件
1 2 3 4 5 6 7 |
opkg update opkg install cfdisk opkg install kmod-usb-storage opkg install block-mount opkg install samba36-server opkg install luci-app-samba opkg install ntfs-3g |
2、将闲置的空间分区下
1 |
cfdisk |






然后选择闲置的磁盘进行分区,分区完后对分区进行格式化
1 |
mkfs.ext4 /dev/sdb1 |



2、将分区挂载到我们要扩容的那个分区去


最后点击保存,然后重启设备后就可以看到分区变大了


x86 ext4分区到这里就完成了!
二、x86的squashfs efi版本扩容步骤
1、安装必要软件
1 2 3 4 |
opkg update opkg install fdisk opkg install blkid opkg install resize2fs |
2、将闲置的空间分区下
先查看下当前分区
1 |
fdisk -l |

先记录下/dev/sda2分区的start数值(这里是33972),后面会用到
然后对磁盘进行分区
1 |
fdisk /dev/sda |
删除第二个分区,并且创建新的分区
顺序是先输入d,回车,再输入2,回车,然后输入n,回车,输入p回车,输入2,回车,然后这里输入刚才记录的数值33972,回车,然后再回车,然后输入N(不移除标识) ,然后输入w保存

开始扩容
1 |
resize2fs -f /dev/loop0 |
然后查看下mmcblk0p2的uuid是多少
1 |
blkid |

然后将/dev/sda2的uuid记录下来.
修改启动项,将启动项的UUID替换成刚才记录的UUID,然后重启即可
1 |
vi /boot/grub/grub.cfg |

到这里,x86 squashfs的扩容就完成了。
三、arm的squashfs版本扩容步骤(这里用的是Raspberry Pi 4 Model B)
1、安装必要软件
1 2 3 4 5 |
opkg update opkg install fdisk opkg install blkid opkg install resize2fs opkg install losetup |
2、将闲置的空间分区下
1 |
fdisk /dev/mmcblk0 |
输入p先查看原有/dev/mmcblk0p2的起始位置(我的是147456)
输入d 回车 3 删除mmcblk0p3分区(如果有做这一步,如果没有不需要)
输入d 回车 2 删除mmcblk0p2分区
输入n 回车 新建一个分区,开始位置需与原来的mmcblk0p2一致(这里是147456)
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
root@OpenWrt:~# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.39).
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 360447 212992 104M 83 Linux
/dev/mmcblk0p3 360448 249737215 249376768 118.9G 83 Linux
Command (m for help): d
Partition number (1-3, default 3): <----如果没有这个分区不需要删。这里删了它,是为了后面合入2做准备!
Partition 3 has been deleted.
Command (m for help): d
Partition number (1,2, default 2): <----先把2分区删了,后面会加回来的,主要是为了修改End区的值。
Partition 2 has been deleted.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (2-4, default 2):
First sector (2048-249737215, default 2048): 147456 <----这个值一定要用上面mmcblk0p2的原始值,后面就直接回车
Last sector, +/-sectors or +/-size{K,M,G,T,P} (147456-249737215, default 249737215):
Created a new partition 2 of type 'Linux' and of size 119 GiB.
Partition #2 contains a squashfs signature.
Do you want to remove the signature? [Y]es/[N]o: N <----注意这里选No!!!
Command (m for help): w <----保存
The partition table has been altered.
Syncing disks.
|
1 |
reboot |
重启完后对分区进行大小调整
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
root@OpenWrt:~# df -h <----先查看,没有变 Filesystem Size Used Available Use% Mounted on /dev/root 5.0M 5.0M 0 100% /rom tmpfs 928.4M 64.0K 928.4M 0% /tmp /dev/loop0 87.3M 3.3M 77.1M 4% /overlay overlayfs:/overlay 87.3M 3.3M 77.1M 4% / /dev/mmcblk0p1 63.9M 17.7M 46.2M 28% /boot tmpfs 512.0K 0 512.0K 0% /dev root@OpenWrt:~# resize2fs -f /dev/loop0 <----调整 resize2fs 1.47.0 (5-Feb-2023) Filesystem at /dev/loop0 is mounted on /overlay; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 953 The filesystem on /dev/loop0 is now 124789824 (1k) blocks long. |
再查看,生效:
1 2 3 4 5 6 7 8 |
root@OpenWrt:~# df -h Filesystem Size Used Available Use% Mounted on /dev/root 5.0M 5.0M 0 100% /rom tmpfs 928.4M 64.0K 928.4M 0% /tmp /dev/loop0 111.9G 3.3M 107.1G 0% /overlay overlayfs:/overlay 111.9G 3.3M 107.1G 0% / /dev/mmcblk0p1 63.9M 17.7M 46.2M 28% /boot tmpfs 512.0K 0 512.0K 0% /dev |
到这里arm架构的squashfs固件就扩容完成了。
3万+

被折叠的 条评论
为什么被折叠?



