平头哥Sipeed LicheeRV 86开发板分配root分区非常小,使用起来不方便,
最近在网上看到一篇关于《SD卡中Linux系统扩容》的文章,想想给我们的“平头哥Sipeed LicheeRV 86开发板”也分配一下空间,让使用起来方便一下(当然要编译文件系统时,可以设置,但重新编译系统,非常慢 )
1 SD卡中Linux系统扩容
SD中的Linux系统扩容,参考https://www.lxx1.com/4744
1.1 确定SD卡的盘符
将SD卡插到读卡器中,借助ubuntu开发电脑来进行系统的扩容。
首先确认下sd卡的盘符:
未插入SD卡, 查看一下ls /dev/sd*
sun@sun-ubuntu:~$ ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda5
插SD卡后, 用df -h
发现SD增加设备是/dev/sdb,/dev/sdbn是SD卡的分区, 我们要扩容的/dev/sdb7分区就是tina(licheeRV86 带Linux系统)的根root分区。
1.2 卸载分区并重新分区
使用如下指令卸载磁盘并使用fdisk重新分区:
umount /dev/sdb7
sudo fdisk /dev/sdb
不会用工具,首先要 查看帮助, 输入m
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
然后输入p(p print the partition table)来查看当前分区情况:
记住/dev/sdb7分区的开始扇区(我的是100432,等会要用到)
1.3 删除分区并重建分区
删除分区:
- d
选择删除分区7:
- 7
然后新建分区:
- n
起始扇区选择原来的点:
- 100432
最后一个扇区选择默认:
- enter
接着提示是否移除分区的签名“,选择否:
- N
存刚才的分区:
- w
1.4 使分区修改生效
sudo e2fsck /dev/sdb7
sudo resize2fs /dev/sdb7
1.5 查看分区后的效果
以上就完成了SD卡口Linux的根(root)分区扩容,将SD卡重新插回到板子中查看:
可以看到扩容成功了。