Skip to content

AN04: How to make LUKS volume on the favorite partition

Seiichi "Suikan" Horie edited this page Jul 22, 2021 · 5 revisions

Kaiten-yaki creates the LUKS volume on the 1st partition for the BIOS system ( 2nd partition for the EFI system ) by default. Also, Kaiten-yaki assigns all space for the LUKS volume, except the space for the EFI partition.

This application note explains how to use the favorite partition with favorite size for LUKS volume.

Step 1: Making partitions

To use custom partitioning, the user must create all partitions by themselves. The user can do it with the popular partitioning tool like gparted. It is recommended to set the partition table as MBR and GPT for BIOS and EFI systems, respectively.

In this documentation, we assume the user wants to use /dev/sda5 as LUKS partition to install Ubuntu, as an example.

Step 2: Configuration

Next, the user must configure the config.sh.

The first parameter to edit is DEV parameter which represents the target device. In this example, it must be set as /dev/sda.

export DEV="/dev/sda"

The second parameter to edit is CRYPTPARTITION. By default, this parameter is set automatically according to the firmware type. The EFIPARTITION parameter can be left untouched. This parameter is not used.

if [  ${ISEFI} -ne 0  ] ; then 
# EFI firmware
export EFIPARTITION=1
export CRYPTPARTITION=5
else
# BIOS firmware
export CRYPTPARTITION=5
fi  # EFI firmware

Makes sure the ERASEALL and OVERWRITEINSTALL are 0.

Step 3: Make LUKS partition

After saving the customer config.sh, run the following command to set the environment variable.

source config.sh

Then, run the following command to create a LUKS volume.

cryptsetup luksFormat --iter-time "${ITERTIME}" --type=luks1 "${DEV}${CRYPTPARTITION}"

This command sets up the LUKS volume on the specified partition. This command also asks for the passphrase going to be set to the LUKS volume.

Step 4: Run Kaiten-yaki

Now, it's time to run Kaiten-yaki

source kaiten-yaki-ubuntu

All other operations are the same as usual install by Kaiten-yaki.