-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Recoverable Partition Scheme
Currently the image creation is fixed in the brickstrap.sh script. It would be better if this was factored out user/target to configuration, so that each build type can specify it's own partition scheme, etc.
My use case is for devices deployed in remote locations, that need to be remotely upgraded, and cannot be bricked if something goes wrong in the upgrade process. e.g. loss of network, power drop out, etc. In general this is solved by have multiple rootfs partitions.
My use case
| Partition | Purpose | File System | Size |
|---|---|---|---|
| 1 | BOOT | VFAT | 32MB, 64MB |
| 2 | ROOTFS1 | ext4 | 1GB |
| 3 | ROOTFS2 | ext4 | 1GB |
| 4 | DATA | VFAT, ext4 | 14GB - 30GB |
More general use case
| Partition | Purpose | File System | Size |
|---|---|---|---|
| 1 | BOOT | VFAT, FAT32, FAT16, FAT12 | 32MB, 48MB, 64MB |
| 2 | ROOTFS1 | ext2, ext3, ext4 | 512MB, 1GB, 2GB |
| 3 | ROOTFS2 | ext2, ext3, ext4 | 512MB, 1GB, 2GB |
| 4 | DATA | VFAT, ext2, ext3, ext4 | 1GB - 30GB |
Other partitioning schemes can be considered, including those with logical volumes, extended volumes, lvm, etc.
Ping-Pong Rootfs
When a reboot occurs, the boot loader should have the capability to fallback to the last working rootfs if the latest rootfs fails integrity checks, does not load properly or does not run to a certain state where it would set something to notify the bootloader of it's success (e.g. a u-boot env var). This is sometimes referred to as a ping-pong rootfs system.
Golden Rootfs
A similar approach is to have the first partition the golden partition that never gets touched once programmed in the factory, and the second rootfs is the only one that gets upgraded. This can have issues of upgrading an upgraded system. i.e. upgrading a running system. It can be solved by booting into the golden partition before doing the upgrade of the 2nd partition. This can mean the system is down while doing the upgrade, which may not be acceptable.
An extension of the Golden Rootfs is to have a 3 rootfs partions -- one golden that never ever gets touched, and two other rootfs partitions for ping-pong. The Golden (or Recovery/Fallback) partition is usually small and simple whose main purpose is to be able to upgrade the main rootfs partitions with valid information.