| 1 |
.. _custom_volumes: |
| 2 |
|
| 3 |
Custom Disk Volumes |
| 4 |
=================== |
| 5 |
|
| 6 |
.. sidebar:: Abstract |
| 7 |
|
| 8 |
This chapter provides high-level explanations on how to handle volume |
| 9 |
or subvolume definitions for disk images using {kiwi}. |
| 10 |
|
| 11 |
{kiwi} supports defining custom volumes by using the logical volume manager |
| 12 |
(LVM) for the Linux kernel or by setting volumes at the filesystem level when |
| 13 |
the filesystem supports it (e.g., btrfs). |
| 14 |
|
| 15 |
Volumes are defined in the {kiwi} description file, :file:`config.xml`, |
| 16 |
using `systemdisk`. This element is a child of the `type` element, which in |
| 17 |
turn is a child of `preferences`. Volumes themselves are added via (multiple) |
| 18 |
`volume` child elements of the `systemdisk` element: |
| 19 |
|
| 20 |
.. code:: xml |
| 21 |
|
| 22 |
<image schemaversion="{schema_version}" name="openSUSE-Leap-16.0"> |
| 23 |
<preferences> |
| 24 |
<type image="oem" filesystem="btrfs"> |
| 25 |
<systemdisk name="vgroup" preferlvm="true"> |
| 26 |
<volume name="usr/lib" size="1G" label="library"/> |
| 27 |
<volume name="@root" freespace="500M"/> |
| 28 |
<volume name="etc_volume" mountpoint="etc" copy_on_write="false"/> |
| 29 |
<volume name="bin_volume" size="all" mountpoint="/usr/bin" quota="2G"/> |
| 30 |
</systemdisk> |
| 31 |
</type> |
| 32 |
</preferences> |
| 33 |
</image> |
| 34 |
|
| 35 |
Additional non-root volumes are created for each `volume` |
| 36 |
element. Volume details can be defined by setting the following `volume` |
| 37 |
attributes: |
| 38 |
|
| 39 |
- `name`: Required attribute representing the volume's name. Additionally, this |
| 40 |
attribute is interpreted as the mountpoint if the `mountpoint` attribute |
| 41 |
is not used. |
| 42 |
|
| 43 |
- `mountpoint`: Optional attribute that specifies the mountpoint of this |
| 44 |
volume. |
| 45 |
|
| 46 |
- `size`: Optional attribute to set the size of the volume. If no suffix |
| 47 |
(`M` or `G`) is used, then the value is considered to be in megabytes. |
| 48 |
|
| 49 |
.. note:: Special name for the root volume |
| 50 |
|
| 51 |
You can use the `@root` name to refer to the volume mounted at `/` in |
| 52 |
case some specific size attributes for the root volume have to be |
| 53 |
defined. For instance: |
| 54 |
|
| 55 |
.. code:: xml |
| 56 |
|
| 57 |
<volume name="@root" size="4G"/> |
| 58 |
|
| 59 |
In addition to the custom size of the root volume, it's also possible |
| 60 |
to set up the name of the root volume as follows: |
| 61 |
|
| 62 |
.. code:: xml |
| 63 |
|
| 64 |
<volume name="@root=rootlv" size="4G"/> |
| 65 |
|
| 66 |
If no name for the root volume is specified, the |
| 67 |
default name, **LVRoot**, applies. |
| 68 |
|
| 69 |
- `freespace`: Optional attribute defining the additional free space added |
| 70 |
to the volume. If no suffix (`M` or `G`) is used, the value is considered |
| 71 |
to be in megabytes. |
| 72 |
|
| 73 |
- `label`: Optional attribute to set the filesystem label of the volume. |
| 74 |
|
| 75 |
- `copy_on_write`: Optional attribute to set the filesystem copy-on-write |
| 76 |
attribute for this volume. |
| 77 |
|
| 78 |
- `quota`: Optional attribute for the `btrfs` filesystem only. Allows |
| 79 |
you to specify a quota size for the generated volume. |
| 80 |
|
| 81 |
- `parent`: Optional attribute for the `btrfs` volume manager only. The |
| 82 |
name or path of the parent subvolume this volume should be nested in. |
| 83 |
If not set, the volume is created below the default volume. |
| 84 |
|
| 85 |
- `filesystem_check`: Optional attribute to indicate that this |
| 86 |
filesystem should perform the validation to become filesystem-checked. |
| 87 |
The actual constraints of whether the check is performed or not depends on |
| 88 |
systemd and filesystem-specific components. If not set or set to |
| 89 |
`false`, no system component will be triggered to run an eventual |
| 90 |
filesystem check, which results in this filesystem never being checked. |
| 91 |
The latter is the default. |
| 92 |
|
| 93 |
- `arch`: Optional attribute to create the volume only if it matches |
| 94 |
the specified host architecture. Multiple architecture names can |
| 95 |
be specified as a comma-separated list. |
| 96 |
|
| 97 |
.. warning:: |
| 98 |
The size attributes for filesystem volumes, as for btrfs, are |
| 99 |
ignored and have no effect. |
| 100 |
|
| 101 |
The `systemdisk` element additionally supports the following optional |
| 102 |
attributes: |
| 103 |
|
| 104 |
- `name`: The volume group name, by default, `systemVG` is used. This setting |
| 105 |
is only relevant for LVM volumes. |
| 106 |
|
| 107 |
- `preferlvm`: A boolean value instructing {kiwi} to prefer LVM even if the |
| 108 |
used filesystem has its own volume management system. |