0

I have to update some outdated embedded systems. But the RAUC Update contains four partitions, while the old systems have only three partitions.

The additional Partition is at the start of the disk and I cannot flash the devices with an external Adapter.

What I have, is SSH access to the existing Linux on the device.

Could I change the partition table somehow from within the running system and thereby move the system partition?

Or could I somehow dd the whole disk with a new image?

I just cannot get my head around this problem and I am not sure, if I am missing a good solution here.

1 Answer 1

1

I did something similar on an embedded system. What saved me was that the compressed image of the new disk (with all its partitions) was small enough to keep in memory.

What I did was to patch the initramfs to include a custom script. At boot, before mounting anything, it copied the (compressed) disk image into a ramfs filesystem, and decompressed it to dd of=/dev/<disk>, completely overwriting everything, including new partitioning.

(I had to struggle a bit to retain certain files. In the end I did a tarball of what I wanted to retain, put this as well in the tmpfs, and untarred this onto the new filesystem. It's working pretty well.)

I'm sure that there are prettier solutions, but this worked for me.

[Edited to add:]

Another option would be to add a small script in the initramfs that would pull in the disk image over network. You'd have to figure out IP settings etc without the benefit of the full system, which can be awkward. But I think that putting a script in the initramfs is probably your best option as it can run from ram, without mounting any disks, so that you can overwrite the lot.

2
  • 1
    I though it would not work on our system, but it might actually do the trick.
    – Cellcon
    Commented Nov 11, 2023 at 21:47
  • Give it a try. And if you find out any better way, I'd like to know about it! (At the time I was looking into using PXE to boot over IP, but that turned out to be more complicated.)
    – Popup
    Commented Nov 13, 2023 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .