milk-v duo 的官方镜像写入的 / 空间只有几百M,而我的sd 卡却有16G 的空间,这样就有13G 左右的空间闲置了,经过实测和多翻尝试,使用下面的方法可以扩展 / 空间。
1、把sd 卡插到一个读卡器上,然后用一个LINUX 系统读出,我用的是ubuntu 20.04
2、运行 lsblk 查看sd卡的名称
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 931.5G 0 disk
(snip! a lot of extra junk was here)
sdf 8:80 1 0B 0 disk
sdg 8:96 1 16.1G 0 disk <---- 我的SD卡
├─sdg1 8:97 1 128M 0 part
├─sdg2 8:98 1 768M 0 part
└─sdg3 8:99 1 256M 0 part
运行 fdisk /dev/sdg 修改分区
Command (m for help): d
Partition number (1-3, default 3): 2
Partition 2 has been deleted.
Command (m for help): d
Partition number (1,3, default 3): 3
Partition 3 has been deleted.
Command (m for help):
删除旧的分区
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (262145-250347519, default 264192): 262145
Last sector, +/-sectors or +/-size{K,M,G,T,P} (262145-250347519, default 250347519): +12G
Created a new partition 2 of type 'Linux' and of size 12 GiB.
Partition #2 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o:N <-----是否移除签名,选N
保险起建,选一下分区类型
Command (m for help): t
Partition number (1,2, default 2): 2
Hex code or alias (type L to list all): 83
Changed type of partition 'Linux' to 'Linux'.
最后保存
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
运行 e2fsck -f /dev/sdg2 检查一下
e2fsck 1.46.5 (30-Dec-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
rootfs: 4730/49152 files (0.6% non-contiguous), 180791/786432 blocks
最后运行 resize2fs /dev/sdg2 调整容量
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on /dev/sdg2 to 125042684 (1k) blocks.
The filesystem on /dev/sdg2 is now 125042684 (1k) blocks long.
这个调整容量可能会很久,需要准备充足的时间。完成后就可以了。