CoreMP135分区扩容

1.为了适应不同的MicroSD卡容量以及加快固件烧写速度,镜像的根文件系统分区并不会完全填充所有容量, 你可以参考以下fdisk指令去实现扩容。M5_CoreMP135_debian12_20240507/M5_CoreMP135_buildroot_20240508以上版本, 在/usr/local/m5stack路径下提供了resize_mmc.sh扩容脚本, 可直接执行进行自动扩容, 完成后重启即可。

1.查看分区

fdisk /dev/mmcblk0

# 查看当前分区
Command (m for help): p

Disk /dev/mmcblk0: 29.72 GiB, 31914983424 bytes, 62333952 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: gpt
Disk identifier: 7067FB81-6C05-45AC-9375-326E6B8BE20A

Device           Start     End Sectors  Size Type
/dev/mmcblk0p1      34     545     512  256K Linux reserved
/dev/mmcblk0p2     546    1057     512  256K Linux reserved
/dev/mmcblk0p3    1058    1569     512  256K Linux reserved
/dev/mmcblk0p4    1570    2081     512  256K Linux reserved
/dev/mmcblk0p5    2082   10273    8192    4M unknown
/dev/mmcblk0p6   10274   18465    8192    4M unknown
/dev/mmcblk0p7   18466   19489    1024  512K Linux reserved
/dev/mmcblk0p8   19490  150561  131072   64M Linux filesystem
/dev/mmcblk0p9  150562  183329   32768   16M Linux filesystem
/dev/mmcblk0p10 183330 2621406 2438077  1.2G Linux filesystem

2.重建分区

1.使用d指令删除第10号分区

Command (m for help): d
Partition number (1-10, default 10): 10

Partition 10 has been deleted.

2.再次创建分区, 注意:新分区的First sector地址需要与原分区信息一致(183330),否则将导致数据丢失, 提示是否移除存在的分区标志, 选择no。

Command (m for help): n
Partition number (10-128, default 10):
First sector (183330-62333918, default 184320): 183330
): t sector, +/-sectors or +/-size{K,M,G,T,P} (183330-62333918, default 62332927)

Created a new partition 10 of type 'Linux filesystem' and of size 29.6 GiB.
Partition #10 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: n

3.保存修改

1.输入指令p查看新的分区信息,输入指令w写入保存。

Command (m for help): p
Disk /dev/mmcblk0: 29.72 GiB, 31914983424 bytes, 62333952 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: gpt
Disk identifier: 7067FB81-6C05-45AC-9375-326E6B8BE20A

Device           Start      End  Sectors  Size Type
/dev/mmcblk0p1      34      545      512  256K Linux reserved
/dev/mmcblk0p2     546     1057      512  256K Linux reserved
/dev/mmcblk0p3    1058     1569      512  256K Linux reserved
/dev/mmcblk0p4    1570     2081      512  256K Linux reserved
/dev/mmcblk0p5    2082    10273     8192    4M unknown
/dev/mmcblk0p6   10274    18465     8192    4M unknown
/dev/mmcblk0p7   18466    19489     1024  512K Linux reserved
/dev/mmcblk0p8   19490   150561   131072   64M Linux filesystem
/dev/mmcblk0p9  150562   183329    32768   16M Linux filesystem
/dev/mmcblk0p10 183330 62332927 62149598 29.6G Linux filesystem


Command (m for help): w

The partition table has been altered.
Syncing disks.

4.扩容完成

5.使用resize2fs指令更新文件系统大小, 然后重启设备即可完成扩容。

resize2fs -f /dev/mmcblk0p10
On This Page