[BPI-R3] OpenWRT 23.05.0 How to extend "production" partition?

I searched the previous discussions but could not find a solution to this specific use case. If not, please excuse me.

I just installed OpenWRT stable release and I want to extend Disk Space to have more room for packages. I run “parted” from EMMC and have this partitions:


Number  Start   End     Size    File system  Name          Flags
128     17.4kB  4194kB  4177kB                             bios_grub
 1      4194kB  4719kB  524kB                ubootenv      hidden, legacy_boot
 2      4719kB  6816kB  2097kB               factory       hidden
 3      6816kB  11.0MB  4194kB               fip           boot, hidden, esp
        11.0MB  12.6MB  1573kB  Free Space
 4      12.6MB  46.1MB  33.6MB               recovery      boot, hidden, esp
        46.1MB  67.1MB  21.0MB  Free Space
 5      67.1MB  176MB   109MB                production
 6      176MB   7818MB  7642MB               owrt-volumes  lvm

On Snapshot I used to reboot from NAND and then extend with parted using unallocated free space after the “production” partition. But on Stable release the free space after “production” partitions it is allocated as “owrt-volumes” (/dev/mmcblk0p6)

Can I delete the owrt-volumes before extend “production” (/dev/mmcblk0p5)? There is a different/better way to proceed?

Thanks

No,this will break system

And it is a lvm so you can add/resize partitions with lvm tools

Thanks! I will give a look to this tool.

Here are my notes for setting up each of my BPI-R3 boxes. This has been in stable use for many months now. This should solve your issue.

Getting OpenWRT onto the device in the first place: [OpenWrt Wiki] Sinovoip BananaPi BPi R3 V1.0, V1.1. Firstly put the sdcard image onto the sdcard, set DIP switches to boot into sdcard. Use the serial bootloader menu to have it write to NAND. Remove sdcard, set DIP switches to boot into NAND. Use the serial bootloader menu to have it write into eMMC. Set DIP switches to eMMC, it’s 8Gb of storage.

DIP switches:

  • 0000 NOR
  • 1010 NAND
  • 0100 eMMC (disables sdcard)
  • 1111 sdcard (disables eMMC)

BEFORE doing anything else you need to expand packages storage from its paltry 58Mb. I couldn’t get extroot working on these boards, so flip boot DIP switches to 1010 (NAND) and do:

opkg update
opkg install parted
parted /dev/mmcblk0
print
resizepart 5 +1G
reboot
mount /dev/mmcblk0p66 /mnt
umount /dev/mmcblk0p66
resize.f2fs -s /dev/mmcblk0p66
poweroff

Put DIP switches to 0100 (eMMC) and packages storage should now be 1Gb, which is more than plenty. Probably best to run firstinstall first to factory reset everything, then install autopart and uvol to have the system create a separate LVM partition in the remaining 6Gb of space, this can be formatted as f2fs and used as long term storage e.g. sensor readings. Configuring it as a samba share is useful.

3 Likes

Thanks for the procedure. I will give it a try.

I am having a heck of a time trying to get this working the following are my steps:

  1. I installed Factory image to sdcard
  2. put sdcard in, set switches to up,up,up,up booted and ssh’d in.
  3. ran:
fw_setenv bootcmd "run ubi_init ; env default bootcmd ; saveenv ; reset"; reboot
  1. waited for ~3 mins, was getting red led and +G green led, so I unplugged power
  2. set switches to up,down,up,down booted up with sdcard still in slot
  3. ssh’d in and df to make sure I was not booted to sdcard and got the following
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
tmpfs                   996.8M     18.5M    978.3M   2% /
tmpfs                   996.8M     72.0K    996.7M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
  1. wasnt sure what all these were so just ran the install to eMMC command
fw_setenv bootcmd "run emmc_init ; env default bootcmd ; saveenv ; reset"; reboot 
  1. kept the switches to up,down,up,down and ssh’d back in… still the weird df -h output… tried to run the commands in your block:
root@OpenWrt:~# parted /dev/mmcblk0
GNU Parted 3.6
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Error: /dev/mmcblk0: unrecognised disk label
Model: MMC 008GB0 (sd/mmc)                                                
Disk /dev/mmcblk0: 7818MB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 
(parted) resizepart 5 +1G                                                 
Error: /dev/mmcblk0: unrecognised disk label
(parted)
  1. assumed above is the issue but tried to resize.f2fs (and installed f2fs-tools with opkg), and this fails as there is no mmcblk0p66
root@OpenWrt:~# ls /dev
console       loop0         mmcblk0boot0  mtd3          ptmx          ttyS1         ttyS4         ubi0_3
fd            loop1         mmcblk0boot1  mtd3ro        pts           ttyS10        ttyS5         ubi_ctrl
full          loop2         mmcblk0rpmb   mtdblock0     random        ttyS11        ttyS6         urandom
gpiochip0     loop3         mtd0          mtdblock1     shm           ttyS12        ttyS7         watchdog
hwrng         loop4         mtd0ro        mtdblock2     stderr        ttyS13        ttyS8         watchdog0
i2c-0         loop5         mtd1          mtdblock3     stdin         ttyS14        ttyS9         zero
kmsg          loop6         mtd1ro        null          stdout        ttyS15        ubi0
log           loop7         mtd2          port          tty           ttyS2         ubi0_0
loop-control  mmcblk0       mtd2ro        ppp           ttyS0         ttyS3         ubi0_1
  1. try to boot into eMMC (down,up,down,down) but wont boot (only red LED and no web/ssh)

Additional trials

Any suggestions to where I am going wrong?

You can safely remove owrt-volumes, it’s the LVM2 partition used for uvol to store additional user volumes and/or containers. It may contain your user data, but does not contain anything needed to boot.

1 Like

The output of df -h suggests that you are running from an initramfs – the bootloader decides to start a recovery system instead of running bootcmd in case some crash logs are in pstore or production image has been corrupted. Please check (and remove) the content of /sys/fs/pstore/ and try again.