更改

跳转至: 导航搜索

Orange Pi Zero 3

添加652字节, 2023年7月3日 (一) 14:04
禁止自动扩容TF卡中rootfs分区容量的方法
<ol style="list-style-type: decimal;">
<li><p>首先在'''<span style="color:#FF0000">Ubuntu电脑</span>'''(Windows不行)中将开发板的linux镜像烧录到TF卡中,'''<span style="color:#FF0000">然后重新拔插下TF卡</span>'''</p></li>
<li><p>然后Ubuntu电脑一般会自动挂载TF卡的分区,如果自动挂载正常,使用ls命令可以看到下面的输出</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''ls /media/test/opi_root/'''</p>
<p>bin &nbsp;&nbsp; boot &nbsp;&nbsp; dev &nbsp;&nbsp; etc &nbsp;&nbsp; home &nbsp;&nbsp; lib &nbsp;&nbsp; lost+found &nbsp;&nbsp; media &nbsp;&nbsp; mnt &nbsp;&nbsp; opt &nbsp;&nbsp; proc &nbsp;&nbsp; root &nbsp;&nbsp; run &nbsp;&nbsp; sbin &nbsp;&nbsp; selinux &nbsp;&nbsp; srv &nbsp;&nbsp; sys &nbsp;&nbsp; tmp &nbsp;&nbsp; usr &nbsp;&nbsp; var</p>|}</li>
<li><p>然后在Ubuntu电脑中将当前用户切换成root用户</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sudo -i'''</p>
<p>[sudo] test 的密码:</p>
<p>root@test:~'''<span style="color:#FF0000">#</span>'''</p>|}</li>
<li><p>然后进入TF卡中的linux系统的root目录下新建一个名为'''.no_rootfs_resize'''的文件</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@test:~# '''cd /media/test/opi_root/'''</p>
<p>root@test:/media/test/opi_root/# '''cd root'''</p>
<p>root@test:/media/test/opi_root/root# '''touch .no_rootfs_resize'''</p>
<p>root@test:/media/test/opi_root/root# '''ls .no_rootfs*'''</p>
<p>'''.no_rootfs_resize'''</p>|}</li>
<li><p>然后就可以卸载TF卡,再拔出TF卡插到开发板中启动,linux系统启动时,当检测到'''/root'''目录下有'''.no_rootfs_resize'''这个文件就不会再自动扩容rootfs了</p></li>
<li><p>禁止rootfs自动扩容后进入Linux系统可以看到rootfs分区的总容量只有4GB(这里测试的是桌面版本的镜像),远小于TF卡的实际容量,说明禁止rootfs自动扩容成功</p>
<p>tmpfs 199M 3.2M 196M 2% /run</p>
<p>'''/dev/mmcblk0p1 4.0G 3.2G 686M 83% /'''</p></li>
<li><p>如果需要重新扩容TF卡中rootfs分区的容量,只需要执行下面的命令,然后重新启动开发板的Linux系统即可</p></li></ol>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''注意,请在root用户下执行下面的命令。'''</big>|}
{| class="wikitable" style="width:800px;"
|-
|
root@orangepi:~# '''rm /root/.no_rootfs_resize'''
root@orangepi:~# '''sudo reboot'''
|}
重启后再次进入开发板的Linux系统就可以看到rootfs分区已经扩展为TF卡的实际容量了
'''/dev/mmcblk0p1 15G 3.2G 12G 23% /'''
</li></ol>
<span id="手动扩容tf卡中rootfs分区容量的方法"></span>
<span id="手动扩容tf卡中rootfs分区容量的方法"></span>
=== 手动扩容TF卡中rootfs分区容量的方法 ===
8,460
个编辑

导航菜单