8,460
个编辑
更改
→第一次启动会自动扩容TF卡中rootfs分区的容量
<ol style="list-style-type: decimal;">
<li><p>将开发板的Linux镜像烧录到TF卡中后,可以在'''<span style="color:#FF0000">Ubuntu电脑</span>'''中查看下TF卡容量的使用情况,步骤如下所示:</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''注意,这一步不操作是不影响开发板的Linux系统自动扩容的。这里只是想说明TF卡烧录完Linux镜像后,怎么查看TF卡容量的方法。'''</p></big>|}
<ol style="list-style-type: lower-alpha;">
<li><p>首先在Ubuntu电脑中安装下gparted这个软件</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo apt install -y gparted'''</p>|}</li>
<li><p>然后打开gparted</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo gparted'''</p>|}</li>
<li><p>打开gparted后在右上角可以选择TF卡,然后就可以看到TF卡容量的使用情况</p>
<p>[[File:media/image92.png|575x210px]]</p></li>
<li><p>上图显示的是烧录完Linux桌面版系统后TF卡的情况,可以看到,虽然TF卡的总容量是16GB的(在GParted中显示为14.84GiB),但是rootfs分区(/dev/sdc1)实际只分配了4.05GiB,还剩下10.79GiB未分配</p></li></ol>
</li>
<li><p>然后可以将烧录好Linux系统的TF卡插入开发板中启动,TF卡第一次启动linux系统时会通过'''orangepi-resize-filesystem.service'''这个systemd服务来调用'''orangepi-resize-filesystem'''脚本自动进行rootfs分区的扩容,所以'''<span style="color:#FF0000">无需再手动扩容</span>'''</p></li><li><p>登录系统后可以通过'''df -h'''命令来查看rootfs的大小,如果和TF卡的实际容量一致,说明自动扩容运行正确</p></li></ol> orangepi@orangepi:~$ '''df -h''' Filesystem Size Used Avail Use% Mounted on udev 430M 0 430M 0% /dev tmpfs 100M 5.6M 95M 6% /run '''/dev/mmcblk0p1 15G 915M 14G 7% /'''
{| class="wikitable" style="width:800px;"|-|<p>orangepi@orangepi:~$ '''df -h'''</p><span style="margin-right: 80px;">Filesystem </span><span style="margin-right: 50px;">Size </span><span style="margin-right: 30px;">Used </span><span style="margin-right: 30px;">Avail</span><span style="margin-right: 50px;">Use% Mounted on</span><br><span style="margin-right: 80px;">udev</span><span style="margin-right: 50px;">430M</span><span style="margin-right: 30px;">0</span><span style="margin-right: 70px;">430M </span><span style="margin-right: 90px;">0% /dev</span><br><span style="margin-right: 100px;">tmpfs </span><span style="margin-right: 50px;">100M </span><span style="margin-right: 30px;">5.6M </span><span style="margin-right: 70px;">95M </span><span style="margin-right: 90px;">6% /run</span><br><span style="margin-right: 80px;color:#FF0000">'''/dev/mmcblk0p1'''</span><span style="margin-right: 50px;color:#FF0000">'''15G'''</span><span style="margin-right: 30px;color:#FF0000">'''915M'''</span><span style="margin-right: 70px;color:#FF0000">'''14G'''</span><span style="margin-right: 90px;color:#FF0000">'''7% /'''</span><br><span style="margin-right: 100px;">tmpfs </span><span style="margin-right: 60px;">500M </span><span style="margin-right: 50px;">0 </span><span style="margin-right: 70px;">500M </span><span style="margin-right: 90px;">0% /dev/shm</span><br>|}</li></ol>
<ol start="4" style="list-style-type: decimal;">
<span id="禁止自动扩容tf卡中rootfs分区容量的方法"></span>
=== 禁止自动扩容TF卡中rootfs分区容量的方法 ===