Converting a live device to a robust dual rootfs device

Have you ever wanted to robustly update a bunch of devices, but you can't because they're already in the field, and they are not configured for a robust dual root filesystem layout? Today, we are exploring converting live devices from stock single partition devices into robust dual partition devices.

There has been a thread Mender Hub about live migration of devices to the dual partition devices, but today we focus on a method that leverages Update Modules, which were not available when that post was written. Note that this is still highly experimental, and it has only been tested with Beaglebone Black so far. Still, the methods outlined are quite generic, and with adjustments it can be made to work on most boards.

The way it works is this. You start with a device that has a single root filesystem:

Device with single root filesystem

The problem is that you cannot make any changes to the partition table of a running system, much less to the partitions inside of it! So we need to get off the root filesystem somehow. What the module does is that it extracts a mini operating system on the device's RAM, and then switches over to running from there after shutting down all processes on the system. This gives it full access to the partition table and the raw partitions inside it:

Full access to partitions

From here we can make any modification we want, including moving, resizing and creating new partitions, which is exactly what we need. The Update Module proceeds by creating the standard Mender partition layout, and moving and resizing the existing partition to fit within it:

New partition layout

After this it switches off the root filesystem partition B, and then reboots the system. It should now be back in a state where it looks more or less exactly like before, except it now runs with a Mender partition layout:

Running new partition layout

This looks cool, but what about trying it yourself? As mentioned before, this has only been tested on Beaglebone Black, so you will need one of those if you expect things to work out of the box. Head over to the Dual Rootfs Partitioner Update Module on Mender Hub to find instructions!

If you want to experiment with your own board, then you may consider going directly to the Update Module repository to learn more about how it works internally.

Recent articles

Transforming business: It’s “All On” for the future of IoT | Mender

Transforming business: It’s “All On” for the future of IoT

Insights from CES 2024 Billed as “the most powerful tech event in the world,” CES 2024 brought together more than 135 thousand attendees and four thousand
Full speed ahead: The software-defined vehicle of the future | Mender

Full speed ahead: The software-defined vehicle of the future

Distinguished panelists discuss infotainment and entertainment services for the software-defined vehicle. Automotive OEMs must innovate to move towards a s
The Future of the Embedded Linux Ecosystem | Mender

The Future of the Embedded Linux Ecosystem

Insights from the Linux Plumbers Conference 2023 The global Linux market is forecasted to reach $15.64 trillion by 2027, and commands usage among nearly ha
View more articles

Learn more about Mender

Explore our Resource Center to discover more about how Mender empowers both you and your customers with secure and reliable over-the-air updates for IoT devices.