Creating the TARGET partitions

When the TARGET filesystem is allocated on partitions, the layout of these partitions and the partition table format need to be choosen.

Note

This information does not apply if you choose to raise the TARGET in a directory, for example to create a container image.

There are several ways of laying out the partitions of the disk depending of the different intended purposes of the final system. The BANDIT expects a simple initial partition scheme for a first installation of a new phySystem. Later on, more complicated layouts can be developed when the phySystem is finally operative.

Partition layout

The supported partition layout for raising a phySystem using the BANDIT consists of:

  • one partition for the root filesystem

  • one (optional) partition for the swap area.

These are the partitions expected to exist in the HOST system and available for the TARGET system during the process of raising a phySystem. You can later provision several additional partitions like the /boot partition, the /home partition and others, if they are needed.

Expected partitions

Root partition

The root partition stores the root filesystem of the phySystem including the boot directory, the home directory, etc., as expected in any Linux distribution.

This partition will also contain the filesystem of the BUILDER system, which is embedded in a directory of the TARGET filesystem as defined in the bandit.conf file. Once the TARGET system is ready this temporary directory for the BUILDER system can be removed to save some disk space.

Swap area

The swap partition stores the swap area for the phySystem. This partition is optional if you plan to raise a system with no swap partition.

Note

In multi-boot environments this swap area can be shared with other installed distros on the same machine, provided that this area is not used for hibernation by this or some of the other coexisitin distros.

Create the partitions

Prepare the partitioning

Warning

You need to work as the root or as a privileged user in the HOST system and create disks partitions for the new TARGET system. If you don’t know how to perform these tasks DO NOT CONTINUE. You can destroy the partitions of the HOST system and loose your data.

Log in as root user or use sudo commands to obtain the necessary privileges for these operations.

Identify the available disks and partitions in the HOST system:

# lsblk

In this example output, a disk /dev/sdc has already two partitions suitable for installing a phySystem, and a third disk /dev/sdd is clean with no partitions. Note that the HOST system has booted from disk /dev/sda and the swap area is assigned to /dev/sda2.

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   20G  0 disk
|-sda1   8:1    0   16G  0 part /
`-sda2   8:2    0    2G  0 part [SWAP]
sdc      8:32   0  160G  0 disk
|-sdc1   8:33   0   60G  0 part
`-sdc2   8:34   0    4G  0 part
sdd      8:48   0  160G  0 disk
sr0     11:0    1 1024M  0 rom

Create the partitions

Create the partitions in the selected disk. For example, to use the partitions in disk /dev/sdd in the previous example, use:

# cfdisk /dev/sdd

For a MBR partition scheme

Mark the root partition as type 83 (Linux) and set the BOOT flag ON.

Mark the swap partition as type 82 (Linux swap).

For a GPT partition scheme

Note

Some legacy BIOS machines may require an additional BIOS partition of at least 1 MB. Mark it as type 4 (BIOS Boot), if needed this partition is needed.

Mark the root partition as type 20 (Linux filesystem).

Mark the swap partition as type 19 (Linux swap).