Problems resizing the root FS on R2S

Hello everyone.

I get an error when trying to change the root partition. Below are my steps

Is it possible to change the root partition if the system is installed and running on the SD card?

Device -> Nanopi R2S
Stable Release -> OpenWrt 23.05.5
Image -> friendlyarm_nanopi-r2s-ext4-sysupgrade.img.gz https://downloads.openwrt.org/releases/23.05.5/targets/rockchip/armv8/openwrt-23.05.5-rockchip-armv8-friendlyarm_nanopi-r2s-ext4-sysupgrade.img.gz
microSD-> Sandisk 64Gb Partition Table ->msdos

root@OpenWrt:~# lsblk -o +FSTYPE; losetup -l
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
                                       FSTYPE
mmcblk0     179:0    0 59.7G  0 disk   
├─mmcblk0p1 179:1    0   16M  0 part   ext4
└─mmcblk0p2 179:2    0  104M  0 part / ext4
root@OpenWrt:~# opkg update

root@OpenWrt:~# opkg install block-mount kmod-usb-storage kmod-fs-ext4 e2fsprogs


root@OpenWrt:~# ls /dev/mmcblk0*
mkfs.ext4 /dev/mmcblk0* << EOF
> Y
> EOF
mke2fs 1.47.0 (5-Feb-2023)
mkfs.ext4: invalid blocks '/dev/mmcblk0p1' on device '/dev/mmcblk0'

Further steps were not possible.


root@OpenWrt:~# mount -t ext4 /dev/mmcblk0* /mnt 

root@OpenWrt:~# mkdir /tmp/root

root@OpenWrt:~# mount -o bind / /tmp/root

root@OpenWrt:~# cp /tmp/root/* /mnt -a

root@OpenWrt:~# umount /tmp/root


root@OpenWrt:~# umount /mnt

root@OpenWrt:~# block detect > /etc/config/fstab

root@OpenWrt:~#  uci set fstab.@mount[0].target='/overlay'

root@OpenWrt:~# uci set fstab.@mount[0].enabled='1'

root@OpenWrt:~# uci commit fstab


root@OpenWrt:~# reboot

mmcblk0p1 doesn't appear to be the root FS, why are you changing it ?

which (incorrect, it would seem) guide were you trying to follow ?

not sure if https://openwrt.org/docs/guide-user/advanced/expand_root works on the R2S too.

Hi. Thanks for your answer

Clarification. Why did you ask about the instructions?

Are there any errors in them?

because they don't appear to come from here, but from some full blown Linux dist.
in worst case, a LLM.

you still haven't posted the source ...

Below you will see the source, but I suppose it does not matter since the task is the same in my case and in the example.

Source https://forum.gl-inet.com/t/how-to-add-a-usb-drive-or-a-sd-card-as-overlay/40840

cool, then I guess you should ignore https://openwrt.org/docs/guide-user/additional-software/extroot_configuration.

I don't ignore anything if it helps me find the answer. There is a big difference in how it is shown and written, whether it is clear or not to the user.
Sometimes it is clear only to the one who wrote it himself, many users ignore such instructions

I would like to answer fully for Mr. Frolic how it should look when a user helps another user. But at the same time I can't help but note the help of Mr. Frolic

to expand the file system and you need to:

  1. Log in via SSH to your router, for example:

$ ssh root@192.168.1.1

  1. Download the necessary programs:
# opkg update
# opkg install parted losetup resize2fs
  1. Use the script from the OpenWRT wiki to automate the process.

# wget -U "" -O expand-root.sh "https://openwrt.org/_export/code/docs/guide-user/advanced/expand_root?codeblock=0"

  1. make the script executable

# chmod +x expand-root.sh

  1. run script
    ./expand-root.sh

  2. Be sure to reboot the router.

  3. Log in via SSH again and check:

root@OpenWrt:~# df -Th
Filesystem           Type            Size      Used Available Use% Mounted on
/dev/root            ext4           58.9G     19.7M     58.8G   0% /
tmpfs                tmpfs         494.1M   1020.0K    493.1M   0% /tmp
tmpfs                tmpfs         512.0K         0    512.0K   0% /dev

P.S specially for Mr. Frolic
“If you can’t explain something to a 6-year-old, you don’t understand it yourself.”
— Albert Einstein

I also found this method, I don’t know if it’s relevant or not.. I’ll try to check..

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.