在SD卡和eMMC上扩展分区
登录Debian后,为充分利用SD卡上未使用的空间,请执行以下步骤,扩展昉·星光 2 SD卡和eMMC的分区:
- 执行以下命令,列出可使用的磁盘空间:
~# df -h
输出示例:
Filesystem Size Used Avail Use% Mounted on udev 3.7G 0 3.7G 0% /dev tmpfs 793M 3.1M 790M 1% /run /dev/mmcblk1p4 2.0G 1.9G 88M 96% / tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 5.0M 12K 5.0M 1% /run/lock tmpfs 793M 32K 793M 1% /run/user/107 tmpfs 793M 24K 793M 1% /run/user/0
以磁盘名作为参数运行
命令示例:fdisk
命令。root@starfive:~# fdisk /dev/mmcblk<X>
提示: <X>:变量值为0或1。SD卡取1,eMMC取0。示例输出root@starfive:~# fdisk /dev/mmcblk1 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. GPT PMBR size mismatch (4505599 != 62929919) will be corrected by write. 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): d Partition number (1-4, default 4): 4 Partition 4 has been deleted. Command (m for help): n Partition number (4-128, default 4): 4 First sector (34-62929886, default 221184): Last sector, +/-sectors or +/-size{K,M,G,T,P} (221184-62929886, default 62928895): Created a new partition 4 of type 'Linux filesystem' and of size 29.9 GiB. Partition #4 contains a ext4 signature. Do you want to remove the signature? [Y]es/[N]o: N Command (m for help): w The partition table has been altered. Syncing disks.
- 执行
resize2fs
命令调整/dev/mmcblk<X>p4分区的大小,以充分利用未使用的块。提示: <X>:变量值为0或1。SD卡取1,eMMC取0。示例命令和输出:
root@starfive:~# resize2fs /dev/mmcblk1p4 resize2fs 1.46.6-rc1 (12-Sep-2022) Filesystem at /d[ 295.372617] EXT4-fs (mmcblk1p4): resizing filesystem from 535291 to 7838464 blocks ev/mmcblk1p4 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 4 [ 295.993163] EXT4-fs (mmcblk1p4): resized filesystem to 7838464 The filesystem on /dev/mmcblk1p4 is now 7838464 (4k) blocks long.
验证:
执行df -h
命令以验证分区的新大小,并验证扩展分区(/dev/mmcblk<X>p4)的步骤是否成功。提示: <X>:变量值为0或1。SD卡取1,eMMC取0。以下输出表示修改成功:
root@starfive:~# df -h Filesystem Size Used Avail Use% Mounted on udev 3.7G 0 3.7G 0% /dev tmpfs 793M 3.1M 790M 1% /run /dev/mmcblk1p4 30G 1.9G 28G 7% / tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 5.0M 12K 5.0M 1% /run/lock tmpfs 793M 32K 793M 1% /run/user/107 tmpfs 793M 24K 793M 1% /run/user/0