create new tag
view all tags

Disk Partitioning

On EL7 disk partitioning is done using the fstab component, this supports adding disks at any time, not just during the install.

For Debian/Ubuntu the partition layout can be configured via the fstab component but the actual work is done in the installer using partman, any post-install changes currently have to be done manually.

The Debian installer partman configuration comes from templates/lcfg_disks.seed.tt and templates/custom_recipe.tt in the lcfg-install package.


On Debian/Ubuntu LVM is enabled by default at install time and, other than /boot, the partitions are created as logical volumes. There is currently no support for disabling LVM other than by overriding all the preseed options.

d-i partman-auto/method string lvm

Note that due to this the partition names for a disk in the fstab resources (e.g. sda1, sda2) generally have little meaning. The ordering of the tags is important though. It is expected that grub/efi and /boot partitions come at the start of the list before the partitions which can always be LVM volumes.

Any post-install adjustments to the LVM configuration have to be done manually.


On EL7 the disk will configured to use GPT when the fstab.label_<tag> (e.g. fstab.label_sda) resource is set to gpt. On Debian/Ubuntu GPT is enabled by default unless overridden through the preseed resources.

# Using GPT, not sure this is all absolutely necessary
d-i partman-basicfilesystems/choose_label string gpt
d-i partman-basicfilesystems/default_label string gpt
d-i partman-partitioning/choose_label string gpt
d-i partman-partitioning/default_label string gpt
d-i partman/choose_label string gpt
d-i partman/default_label string gpt

UEFI / Legacy boot

On EL7 the default is legacy boot, UEFI can be enabled by either defining the USE_UEFI macro at the top of the LCFG profile or by including the lcfg/options/boot-uefi.h header.

On Debian/Ubuntu the default is UEFI boot, legacy can be enabled by either defining the USE_LEGACY_BOOT macro at the top of the LCFG profile or by including the lcfg/options/boot-legacy.h header.

As well as controlling the boot mechanism this affects the disk layout.


On EL7 with UEFI the partition layout begins like:

 1      524kB   83.9GB  83.9GB  ext4         sda1
 2      83.9GB  84.2GB  287MB   fat32        sda2  boot

Where the second partition is mounted as /boot/efi. With legacy boot the layout begins like:

 1      524kB   16.8GB  16.8GB  ext4            sda1
 2      16.8GB  16.8GB  4719kB                  sda2  bios_grub

In each case the first partition is mounted as / (root).


On Debian with UEFI the partition layout looks like:

With legacy boot the layout looks like this:

 1      1049kB  4194kB  3146kB                     bios_grub
 2      4194kB  1029MB  1024MB  ext2
 3      1029MB  21.5GB  20.4GB                     lvm

Where the second partition is mounted as /boot, note that it's not strictly required these days as grub2 can now access LVM volumes.

Disk Encryption

The fstab component provides support for configuring dm-crypt via /etc/crypttab so that partitions (e.g. /tmp and swap) can be encrypted with a random key at boot time. Work on adding support for this in Debian/Ubuntu is ongoing.

Disk Size

For EL7 the sizes of partitions can be specified explicitly or set to free and for swap there is redhat-autoswap.

For Debian/Ubuntu partman the disk size is configured via 3 parameters - minimum, maximum and priority. These are used to carve up the disk in the "best" way possible according to some algorithm. The free option works in a similar way and will use all remaining disk space after the other partitions have been allocated. The redhat-autoswap option gives a minimum of 100% RAM and a maximum of 200% RAM.

Preserving Partitions

The LCFG fstab component supports preserving the partition layout and the contents of particular partitions. Although it should be possible we do not yet support this for Debian/Ubuntu installs. In reality given the switch to LVM by default all systems will need to be fully reinstalled so this is not a big issue at this time.

Partition Layout


The partman recipe can be selected by setting the install.disk_layout resource. The default is lcfg which means the layout will be driven by the LCFG fstab component resources. It may otherwise be set to one of atomic, multi or home which will mean the standard Debian/Ubuntu recipe of that name is used.

By default the LCFG managed layout is similar to atomic but it can be changed to something closer to multi by defining the LCFG_DISK_LAYOUT_MULTI macro at the start of the LCFG profile. Both support an extra "local part" partition (often /disk/scratch) in the usual way. See the primary-disk-partitions.h header for full details.

The standard recipes can be found at:

Useful Links

-- squinney - 2020-04-17

Topic revision: r2 - 2020-04-17 - squinney
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback