Update UBI volume without sysupgrade

I know which images / UBI volumes are going to be updated. But built-in scripts for sysupgrade do more than that - they erase some stuff, activates volumes being upgraded etc. And in general I do not much "trust" sysupgrade as is because even small mistake in the process (which I must admit not completely understand in detail) or deviation may cause device bricking and downtime. The volumes to update are NOT the ones active and mounted at the time of update.

Is there any existing script, or any other way (which I may implement) to just write kernel and rootfs images into the respective volumes I will point it to? I had been told that using dd is wrong, and update done using it will not boot properly.

The command you are looking for is ubiupdatevol. For an example, see the "Restore to stock" section of the ZTE MF287 devices:

https://openwrt.org/toh/zte/mf287#restore_stock

1 Like

Package facinstall does just that.
This utility hook the sysupgrade call and does some things on its own.

Thank you very much. It seems I have next, related issue. The UBI volume is created in u-boot with

ubi create rootfs_b 0x2A00000

but when I perform df in OS, I see

ubi0:rootfs_b            37844     34948      2896  92% /rom

which is 0x24F5000. I recall when u-boot writes to the volume at initialization

ubi write 0x42000000 rootfs_b ${filesize_rootfs}

it says that it truncates / resizes the volume to the size of update file.

Where does that space between original 0x2A00000 and actual 0x24F5000 go? Imagine my update file will appear larger than current size of 0x24F5000 - will ubiupdatevol be able to upsize the volume up to 0x2A00000?

(sysupgrade obviously should be able to do it in its deepness I hope).

I never tried that, I always delete the UBI volume and recreate it with the correct size. See the link I already posted, there are the commands for deletion and recreation included.

I have had negative experience with that when volumes change their allocation.

I found this ubirsvol which may be the one I need to resize the volume to its original size.

Ok, no need to resize the volume. The size reported by the df is size of the image within the volume, and NOT size of UBI volume.

Volume ID:   3 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        347 LEBs (44060672 bytes, 42.0 MiB)
State:       OK
Name:        rootfs_b
Character device major/minor: 246:4

which is 0x2A05000. Not sure why it is not 0x2A00000 as instructed by the u-boot, maybe there's some overhead or just LEB rounding into the larger size.

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