Open main menu

Wiki-Orange Pi β

Changes

Orange Pi Zero 3

2,607 bytes added, 19:55, 10 July 2023
The method of prohibiting automatic expansion of the capacity of the rootfs partition in the TF card
=== The method of prohibiting automatic expansion of the capacity of the rootfs partition in the TF card ===
# First burn the linux image of the development board to the TF card on the '''<span style="color:#FF0000">Ubuntu computer</span>''' (Windows not available), '''<span style="color:#FF0000">and then re-plug and insert the TF card</span>'''
# Then the Ubuntu computer will automatically mount the partition of the TF card. If the automatic mounting is normal, use the ls command to see the following output
::{| 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 <br> sbin &nbsp;&nbsp; selinux &nbsp;&nbsp; srv &nbsp;&nbsp; sys &nbsp;&nbsp; tmp &nbsp;&nbsp; usr &nbsp;&nbsp; var</p>|}
<ol start="3" style="list-style-type: decimal;">
<li>Then switch the current user to the root user on the Ubuntu computer</li></ol>
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''sudo -i'''
[sudo] test 的密码:
root@test:~'''<span style="color:#FF0000">#</span>'''|}</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then enter the root directory of the linux system in the TF card and create a new file named '''.no_rootfs_resize'''</li></ol>
{| class="wikitable" style="width:800px;"
|-
|
root@test:~# '''cd /media/test/opi_root/'''
'''.no_rootfs_resize'''
|}</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>Then you can uninstall the TF card, and then pull out the TF card and insert it into the development board to start. When the linux system starts, when the file'''.no_rootfs_resize''' is detected in the '''/root''' directory, the rootfs will not be automatically expanded.</p></li>
<li><p>After entering the Linux system after prohibiting automatic expansion of rootfs, you can see that the total capacity of the rootfs partition is only 4GB (the image of the desktop version is tested here), which is much smaller than the actual capacity of the TF card, indicating that the automatic expansion of rootfs is prohibited.</p></li></ol> orangepi@orangepi:~$ '''df -h''' Filesystem Size Used Avail Use% Mounted on udev 925M 0 925M 0% /dev tmpfs 199M 3.2M 196M 2% /run '''/dev/mmcblk0p1 4.0G 3.2G 686M 83% /'''
{| 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: 110px;">udev</span><span style="margin-right: 60px;">925M </span><span style="margin-right: 50px;">0</span><span style="margin-right: 70px;">925M </span><span style="margin-right: 90px;">0% /dev</span><br>
<span style="margin-right: 100px;">tmpfs </span><span style="margin-right: 50px;">199M </span><span style="margin-right: 30px;">3.2M </span><span style="margin-right: 70px;">196M </span><span style="margin-right: 90px;">2% /run</span><br>
<span style="margin-right: 25px;color:#FF0000">'''/dev/mmcblk0p1'''</span><span style="margin-right: 50px;color:#FF0000">'''4.0G '''</span><span style="margin-right: 35px;color:#FF0000">'''3.2G '''</span><span style="margin-right: 80px;color:#FF0000">'''686M '''</span><span style="margin-right: 90px;color:#FF0000">'''83% /'''</span><br>
|}
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>If you need to re-expand the capacity of the rootfs partition in the TF card, just execute the following command, and then restart the Linux system of the development board.</li></ol>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note, please execute the following commands under the root user.'''</big>|}
{| class="wikitable" style="width:800px;"
|-
|
root@orangepi:~# '''rm /root/.no_rootfs_resize'''
root@orangepi:~# '''sudo reboot'''
|}
After restarting, enter the Linux system of the development board again, and you can see that the rootfs partition has been expanded to the actual capacity of the TF card
{| class="wikitable" style="width:800px;"|-|<p>root@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: 110px;">udev</span><span style="margin-right: 60px;">925M </span><span style="margin-right: 50px;">0</span><span style="margin-right: 70px;">925M </span><span style="margin-right: 90px;">0% /dev</span><br><span style="margin-right: 100px;">tmpfs </span><span style="margin-right: 50px;">199M </span><span style="margin-right: 30px;">3.2M </span><span style="margin-right: 70px;">196M </span><span style="margin-right: 90px;">2% /run</span><br><span style="margin-right: 25px;color:#FF0000">'''/dev/mmcblk0p1'''</span><span style="margin-right: 50px;color:#FF0000">'''15G'''</span><span style="margin-right: 35px;color:#FF0000">'''3.2G '''</span><span style="margin-right: 80px;color:#FF0000">'''12G '''</span><span style="margin-right: 90px;color:#FF0000">'''23% /'''</span><br>|}</ol><span id="the-method-of-manually-expanding-the-capacity-of-the-rootfs-partition-in-the-tf-card"></span>
udev 925M 0 925M 0% /dev
 
tmpfs 199M 3.2M 196M 2% /run
 
'''/dev/mmcblk0p1 15G 3.2G 12G 23% /'''
 
<span id="the-method-of-manually-expanding-the-capacity-of-the-rootfs-partition-in-the-tf-card"></span>
=== The method of manually expanding the capacity of the rootfs partition in the TF card ===