Skip to content

Commit 949041f

Browse files
author
Bob Furu
authored
Merge pull request #37958 from bgilbert/mount-unit
2 parents 3138e5c + 91a063e commit 949041f

File tree

3 files changed

+90
-193
lines changed

3 files changed

+90
-193
lines changed

modules/installation-disk-partitioning-upi-templates.adoc

Lines changed: 31 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -29,58 +29,13 @@ It is recommended that disk partitioning for {product-title} be left to the inst
2929

3030
Storing the contents of a `/var` directory separately makes it easier to grow storage for those areas as needed and reinstall {product-title} at a later date and keep that data intact. With this method, you will not have to pull all your containers again, nor will you have to copy massive log files when you update systems.
3131

32-
Because `/var` must be in place before a fresh installation of {op-system-first}, the following procedure sets up the separate `/var` partition by creating a machine config that is inserted during the `openshift-install` preparation phases of an {product-title} installation.
32+
Because `/var` must be in place before a fresh installation of {op-system-first}, the following procedure sets up the separate `/var` partition by creating a machine config manifest that is inserted during the `openshift-install` preparation phases of an {product-title} installation.
3333

3434
[IMPORTANT]
3535
====
3636
If you follow the steps to create a separate `/var` partition in this procedure, it is not necessary to create the Kubernetes manifest and Ignition config files again as described later in this section.
3737
====
3838

39-
.Prerequisites
40-
41-
* If container storage is on the root partition, ensure that this root partition is mounted with the `pquota` option by including `rootflags=pquota` in the GRUB command line.
42-
43-
* If the container storage is on a partition that is mounted by `/etc/fstab`, ensure that the following mount option is included in the `/etc/fstab` file:
44-
+
45-
[source,terminal]
46-
----
47-
/dev/sdb1 /var xfs defaults,pquota 0 0
48-
----
49-
50-
* If the container storage is on a partition that is mounted by `systemd`, ensure that the `MachineConfig` object includes the following mount option as in this example:
51-
+
52-
[source,yaml]
53-
----
54-
spec:
55-
config:
56-
ignition:
57-
version: 3.2.0
58-
storage:
59-
disks:
60-
- device: /dev/sdb
61-
partitions:
62-
- label: var
63-
sizeMiB: 240000
64-
startMiB: 0
65-
filesystems:
66-
- device: /dev/disk/by-partlabel/var
67-
format: xfs
68-
path: /var
69-
systemd:
70-
units:
71-
- contents: |
72-
[Unit]
73-
Before=local-fs.target
74-
[Mount]
75-
Where=/var
76-
What=/dev/disk/by-partlabel/var
77-
Options=defaults,pquota
78-
[Install]
79-
WantedBy=local-fs.target
80-
enabled: true
81-
name: var.mount
82-
----
83-
8439
.Procedure
8540

8641
. Create a directory to hold the {product-title} installation files:
@@ -125,48 +80,47 @@ $ ls $HOME/clusterconfig/openshift/
12580
...
12681
----
12782

128-
. Create a `MachineConfig` object and add it to a file in the `openshift` directory. For example, name the file `98-var-partition.yaml`, change the disk device name to the name of the storage device on the `worker` systems, and set the storage size as appropriate. This attaches storage to a separate `/var` directory.
129-
83+
. Create a Butane config that configures the additional partition. For example, name the file `$HOME/clusterconfig/98-var-partition.bu`, change the disk device name to the name of the storage device on the `worker` systems, and set the storage size as appropriate. This example places the `/var` directory on a separate partition:
13084
+
13185
[source,yaml]
13286
----
133-
apiVersion: machineconfiguration.openshift.io/v1
134-
kind: MachineConfig
87+
variant: openshift
88+
version: 4.9.0
13589
metadata:
13690
labels:
13791
machineconfiguration.openshift.io/role: worker
13892
name: 98-var-partition
139-
spec:
140-
config:
141-
ignition:
142-
version: 3.2.0
143-
storage:
144-
disks:
145-
- device: /dev/<device_name> <1>
146-
partitions:
147-
- sizeMiB: <partition_size>
148-
startMiB: <partition_start_offset> <2>
149-
label: var
150-
filesystems:
151-
- path: /var
152-
device: /dev/disk/by-partlabel/var
153-
format: xfs
154-
systemd:
155-
units:
156-
- name: var.mount
157-
enabled: true
158-
contents: |
159-
[Unit]
160-
Before=local-fs.target
161-
[Mount]
162-
Where=/var
163-
What=/dev/disk/by-partlabel/var
164-
[Install]
165-
WantedBy=local-fs.target
93+
storage:
94+
disks:
95+
- device: /dev/<device_name> <1>
96+
partitions:
97+
- label: var
98+
start_mib: <partition_start_offset> <2>
99+
size_mib: <partition_size> <3>
100+
filesystems:
101+
- device: /dev/disk/by-partlabel/var
102+
path: /var
103+
format: xfs
104+
mount_options: [defaults, prjquota] <4>
105+
with_mount_unit: true
166106
----
167107
+
168108
<1> The storage device name of the disk that you want to partition.
169109
<2> When adding a data partition to the boot disk, a minimum value of 25000 MiB (Mebibytes) is recommended. The root file system is automatically resized to fill all available space up to the specified offset. If no value is specified, or if the specified value is smaller than the recommended minimum, the resulting root file system will be too small, and future reinstalls of {op-system} might overwrite the beginning of the data partition.
110+
<3> The size of the data partition in mebibytes.
111+
<4> The `prjquota` mount option must be enabled for filesystems used for container storage.
112+
+
113+
[NOTE]
114+
====
115+
When creating a separate `/var` partition, you cannot use different instance types for worker nodes, if the different instance types do not have the same device name.
116+
====
117+
118+
. Create a manifest from the Butane config and save it to the `clusterconfig/openshift` directory. For example, run the following command:
119+
+
120+
[source,terminal]
121+
----
122+
$ butane $HOME/clusterconfig/98-var-partition.bu -o $HOME/clusterconfig/openshift/98-var-partition.yaml
123+
----
170124

171125
. Run `openshift-install` again to create Ignition configs from a set of files in the `manifest` and `openshift` subdirectories:
172126
+

modules/installation-disk-partitioning.adoc

Lines changed: 31 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -45,54 +45,9 @@ Storing the contents of a `/var` directory separately makes it easier to grow st
4545

4646
Because `/var` must be in place before a fresh installation of
4747
{op-system-first}, the following procedure sets up the separate `/var` partition
48-
by creating a machine config that is inserted during the `openshift-install`
48+
by creating a machine config manifest that is inserted during the `openshift-install`
4949
preparation phases of an {product-title} installation.
5050

51-
.Prerequisites
52-
53-
* If container storage is on the root partition, ensure that this root partition is mounted with the `pquota` option by including `rootflags=pquota` in the GRUB command line.
54-
55-
* If the container storage is on a partition that is mounted by `/etc/fstab`, ensure that the following mount option is included in the `/etc/fstab` file:
56-
+
57-
[source,terminal]
58-
----
59-
/dev/sdb1 /var xfs defaults,pquota 0 0
60-
----
61-
62-
* If the container storage is on a partition that is mounted by `systemd`, ensure that the `MachineConfig` object includes the following mount option as in this example:
63-
+
64-
[source,yaml]
65-
----
66-
spec:
67-
config:
68-
ignition:
69-
version: 3.2.0
70-
storage:
71-
disks:
72-
- device: /dev/sdb
73-
partitions:
74-
- label: var
75-
sizeMiB: 240000
76-
startMiB: 0
77-
filesystems:
78-
- device: /dev/disk/by-partlabel/var
79-
format: xfs
80-
path: /var
81-
systemd:
82-
units:
83-
- contents: |
84-
[Unit]
85-
Before=local-fs.target
86-
[Mount]
87-
Where=/var
88-
What=/dev/disk/by-partlabel/var
89-
Options=defaults,pquota
90-
[Install]
91-
WantedBy=local-fs.target
92-
enabled: true
93-
name: var.mount
94-
----
95-
9651
.Procedure
9752

9853
. Create a directory to hold the {product-title} installation files:
@@ -117,50 +72,47 @@ $ ls $HOME/clusterconfig/openshift/
11772
...
11873
----
11974

120-
. Create a `MachineConfig` object and add it to a file in the `openshift` directory.
121-
For example, name the file `98-var-partition.yaml`, change the disk device name to the name of the storage device on the `worker` systems, and set the storage size as appropriate. This attaches storage to a separate `/var`
122-
directory.
123-
75+
. Create a Butane config that configures the additional partition. For example, name the file `$HOME/clusterconfig/98-var-partition.bu`, change the disk device name to the name of the storage device on the `worker` systems, and set the storage size as appropriate. This example places the `/var` directory on a separate partition:
12476
+
12577
[source,yaml]
12678
----
127-
apiVersion: machineconfiguration.openshift.io/v1
128-
kind: MachineConfig
79+
variant: openshift
80+
version: 4.9.0
12981
metadata:
13082
labels:
13183
machineconfiguration.openshift.io/role: worker
13284
name: 98-var-partition
133-
spec:
134-
config:
135-
ignition:
136-
version: 3.2.0
137-
storage:
138-
disks:
139-
- device: /dev/<device_name> <1>
140-
partitions:
141-
- sizeMiB: <partition_size>
142-
startMiB: <partition_start_offset> <2>
143-
label: var
144-
filesystems:
145-
- path: /var
146-
device: /dev/disk/by-partlabel/var
147-
format: xfs
148-
systemd:
149-
units:
150-
- name: var.mount
151-
enabled: true
152-
contents: |
153-
[Unit]
154-
Before=local-fs.target
155-
[Mount]
156-
Where=/var
157-
What=/dev/disk/by-partlabel/var
158-
[Install]
159-
WantedBy=local-fs.target
85+
storage:
86+
disks:
87+
- device: /dev/<device_name> <1>
88+
partitions:
89+
- label: var
90+
start_mib: <partition_start_offset> <2>
91+
size_mib: <partition_size> <3>
92+
filesystems:
93+
- device: /dev/disk/by-partlabel/var
94+
path: /var
95+
format: xfs
96+
mount_options: [defaults, prjquota] <4>
97+
with_mount_unit: true
16098
----
16199
+
162100
<1> The storage device name of the disk that you want to partition.
163101
<2> When adding a data partition to the boot disk, a minimum value of 25000 mebibytes is recommended. The root file system is automatically resized to fill all available space up to the specified offset. If no value is specified, or if the specified value is smaller than the recommended minimum, the resulting root file system will be too small, and future reinstalls of {op-system} might overwrite the beginning of the data partition.
102+
<3> The size of the data partition in mebibytes.
103+
<4> The `prjquota` mount option must be enabled for filesystems used for container storage.
104+
+
105+
[NOTE]
106+
====
107+
When creating a separate `/var` partition, you cannot use different instance types for worker nodes, if the different instance types do not have the same device name.
108+
====
109+
110+
. Create a manifest from the Butane config and save it to the `clusterconfig/openshift` directory. For example, run the following command:
111+
+
112+
[source,terminal]
113+
----
114+
$ butane $HOME/clusterconfig/98-var-partition.bu -o $HOME/clusterconfig/openshift/98-var-partition.yaml
115+
----
164116

165117
. Run `openshift-install` again to create Ignition configs from a set of files in the `manifest` and `openshift` subdirectories:
166118
+

modules/installation-user-infra-machines-advanced.adoc

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Storing the contents of a `/var` directory separately makes it easier to grow st
104104

105105
The use of a separate partition for the `/var` directory or a subdirectory of `/var` also prevents data growth in the partitioned directory from filling up the root file system.
106106

107-
The following procedure sets up a separate `/var` partition by adding a `MachineConfig` object that is wrapped into the Ignition config file for a node type during the preparation phase of an installation.
107+
The following procedure sets up a separate `/var` partition by adding a machine config manifest that is wrapped into the Ignition config file for a node type during the preparation phase of an installation.
108108

109109
.Procedure
110110

@@ -115,57 +115,48 @@ The following procedure sets up a separate `/var` partition by adding a `Machine
115115
$ openshift-install create manifests --dir=<installation_directory>
116116
----
117117

118-
. Create a `MachineConfig` object and add it to a file in the `./<installation_directory>/openshift` directory.
119-
For example, name the file `98-var-partition.yaml`,
120-
change the disk device name to the name of the storage device on the compute nodes,
121-
and set the storage size as appropriate. This example mounts the `/var` directory on a separate partition:
122-
118+
. Create a Butane config that configures the additional partition. For example, name the file `$HOME/clusterconfig/98-var-partition.bu`, change the disk device name to the name of the storage device on the `worker` systems, and set the storage size as appropriate. This example places the `/var` directory on a separate partition:
123119
+
124120
[source,yaml]
125121
----
126-
apiVersion: machineconfiguration.openshift.io/v1
127-
kind: MachineConfig
122+
variant: openshift
123+
version: 4.9.0
128124
metadata:
129125
labels:
130126
machineconfiguration.openshift.io/role: worker
131127
name: 98-var-partition
132-
spec:
133-
config:
134-
ignition:
135-
version: 3.2.0
136-
storage:
137-
disks:
138-
- device: /dev/<device_name> <1>
139-
partitions:
140-
- sizeMiB: <partition_size> <2>
141-
startMiB: <partition_start_offset> <3>
142-
label: var
143-
filesystems:
144-
- path: /var
145-
device: /dev/disk/by-partlabel/var
146-
format: xfs
147-
systemd:
148-
units:
149-
- name: var.mount
150-
enabled: true
151-
contents: |
152-
[Unit]
153-
Before=local-fs.target
154-
[Mount]
155-
Where=/var
156-
What=/dev/disk/by-partlabel/var
157-
[Install]
158-
WantedBy=local-fs.target
128+
storage:
129+
disks:
130+
- device: /dev/<device_name> <1>
131+
partitions:
132+
- label: var
133+
start_mib: <partition_start_offset> <2>
134+
size_mib: <partition_size> <3>
135+
filesystems:
136+
- device: /dev/disk/by-partlabel/var
137+
path: /var
138+
format: xfs
139+
mount_options: [defaults, prjquota] <4>
140+
with_mount_unit: true
159141
----
160142
+
161143
<1> The storage device name of the disk that you want to partition.
162-
<2> The size of the data partition in mebibytes.
163-
<3> When adding a data partition to the boot disk, a minimum offset value of 25000 mebibytes is recommended. The root file system is automatically resized to fill all available space up to the specified offset. If no offset value is specified, or if the specified value is smaller than the recommended minimum, the resulting root file system will be too small, and future reinstalls of {op-system} might overwrite the beginning of the data partition.
144+
<2> When adding a data partition to the boot disk, a minimum offset value of 25000 mebibytes is recommended. The root file system is automatically resized to fill all available space up to the specified offset. If no offset value is specified, or if the specified value is smaller than the recommended minimum, the resulting root file system will be too small, and future reinstalls of {op-system} might overwrite the beginning of the data partition.
145+
<3> The size of the data partition in mebibytes.
146+
<4> The `prjquota` mount option must be enabled for filesystems used for container storage.
164147
+
165148
[NOTE]
166149
====
167150
When creating a separate `/var` partition, you cannot use different instance types for compute nodes, if the different instance types do not have the same device name.
168151
====
152+
153+
. Create a manifest from the Butane config and save it to the `clusterconfig/openshift` directory. For example, run the following command:
154+
+
155+
[source,terminal]
156+
----
157+
$ butane $HOME/clusterconfig/98-var-partition.bu -o $HOME/clusterconfig/openshift/98-var-partition.yaml
158+
----
159+
169160
. Create the Ignition config files:
170161
+
171162
[source,terminal]

0 commit comments

Comments
 (0)