User Tools

Site Tools


soft:node-storage-layout

Node storage layout

This specification is a proposal of the partitioning of node storage to support both Node initialization process (with node image selection and safe rollback) and Node persistent data (for sharing configuration and state across node images).

General layout

source Fig. 1: The layout of the storage of a CONFINE node

figure 1 shows a diagram of the layout described below for the particular case of an x86 node. Generally speaking, a node's disk consists of the following partitions:

boot partition
If existing, it holds the data needed to boot an initial OpenWrt system, like a kernel and boot loader files.
init partition
If existing, it holds an initial OpenWrt system.
system partition
It holds a Unix filesystem (e.g. ext4) labeled confine-sys, with various versions of the node's operating system (which includes CONFINE software), and data to be persisted across reboots and versions of the system. It contains:
confine/image-vVERSION/
Contains the different stored node images, arranged according to the format defined in the given VERSION of the specification in Node initialization process.
confine/persist-vVERSION/
The different persistent data sets, arranged according to the format defined in the given VERSION of the specification in Node persistent data.
data partition
It holds a filesystem labeled confine-data, with sliver templates and writable sliver overlays. It can be located in a different disk.

Preparation example

The commands below can be used to create the system partition and filesystem on the device $RD_DISK (e.g. some /dev/sdX that may become /dev/sda in the research device) using an MS-DOS partition table and logical partitions. The system partition takes all disk space minus currently used space e.g. for an already present initial OpenWrt system or a swap partition:

$ # Create an MS-DOS partition table if none existing.
$ /sbin/parted -sm -- "$RD_DISK" print > /dev/null \
  || /sbin/parted -sm -- "$RD_DISK" mklabel msdos
$ # Get the percentage of the first unused location.
$ NEXT_PERCENT=$( /sbin/parted -sm -- "$RD_DISK" unit % print \
                  | tail -n +3 | tail -1 \
                  | cut -f3 -d: | sed -nre 's/^([0-9]+).*/\1/p' )
$ NEXT_PERCENT=$((${NEXT_PERCENT:-0} + 1))
$ # Create a logical partition inside a new extended one.
$ /sbin/parted -s -a optimal -- "$RD_DISK" \
  mkpart extended $NEXT_PERCENT% 100% \
  mkpart logical ext2 $NEXT_PERCENT% 100%
$ # Create the filesystem.
$ SYS_PART_NR=$(/sbin/parted -sm -- "$RD_DISK" print | tail -2 | head -1 | cut -f1 -d:)
$ /sbin/mkfs.ext4 -L confine-sys -- "$RD_DISK${SYS_PART_NR:?}"

(Parted seems to only like percentages, and adding one to the last partition's end percentage (after truncating) surprisingly makes the next partition back to back with the last one.)

soft/node-storage-layout.txt · Last modified: 2014/12/29 13:00 by ivilata