|
8 | 8 |
|
9 | 9 | Configure disk partitioning for a managed cluster using a `SiteConfig` CR and {ztp-first}. The disk partition details in the `SiteConfig` CR must match the underlying disk.
|
10 | 10 |
|
11 |
| -[NOTE] |
| 11 | +[IMPORTANT] |
12 | 12 | ====
|
13 |
| -Use persistent naming for devices to avoid device names such as `/dev/sda` and `/dev/sdb` being switched at every reboot. You can use `rootDeviceHints` to choose the bootable device and then use same device for further partitioning. |
| 13 | +You must complete this procedure at installation time. |
14 | 14 | ====
|
15 | 15 |
|
16 | 16 | .Prerequisites
|
17 | 17 |
|
18 |
| -* You have installed the OpenShift CLI (`oc`). |
| 18 | +* Install Butane. |
| 19 | +
|
| 20 | +.Procedure |
19 | 21 |
|
20 |
| -* You have logged in to the hub cluster as a user with `cluster-admin` privileges. |
| 22 | +. Create the `storage.bu` file. |
| 23 | ++ |
| 24 | +[source,yaml] |
| 25 | +---- |
| 26 | +variant: fcos |
| 27 | +version: 1.3.0 |
| 28 | +storage: |
| 29 | + disks: |
| 30 | + - device: /dev/disk/by-path/pci-0000:01:00.0-scsi-0:2:0:0 <1> |
| 31 | + wipe_table: false |
| 32 | + partitions: |
| 33 | + - label: var-lib-containers |
| 34 | + start_mib: <start_of_partition> <2> |
| 35 | + size_mib: <partition_size> <3> |
| 36 | + filesystems: |
| 37 | + - path: /var/lib/containers |
| 38 | + device: /dev/disk/by-partlabel/var-lib-containers |
| 39 | + format: xfs |
| 40 | + wipe_filesystem: true |
| 41 | + with_mount_unit: true |
| 42 | + mount_options: |
| 43 | + - defaults |
| 44 | + - prjquota |
| 45 | +---- |
| 46 | +<1> Specify the root disk. |
| 47 | +<2> Specify the start of the partition in MiB. If the value is too small, the installation fails. |
| 48 | +<3> Specify the size of the partition. If the value is too small, the deployments fails. |
21 | 49 |
|
22 |
| -* You have created a Git repository where you manage your custom site configuration data for use with {ztp-first}. |
| 50 | +. Convert the `storage.bu` to an Ignition file by running the following command: |
| 51 | ++ |
| 52 | +-- |
| 53 | +[source,terminal] |
| 54 | +---- |
| 55 | +$ butane storage.bu |
| 56 | +---- |
23 | 57 |
|
24 |
| -.Procedure |
| 58 | +.Example output |
| 59 | +[source,terminal] |
| 60 | +---- |
| 61 | +{"ignition":{"version":"3.2.0"},"storage":{"disks":[{"device":"/dev/disk/by-path/pci-0000:01:00.0-scsi-0:2:0:0","partitions":[{"label":"var-lib-containers","sizeMiB":0,"startMiB":250000}],"wipeTable":false}],"filesystems":[{"device":"/dev/disk/by-partlabel/var-lib-containers","format":"xfs","mountOptions":["defaults","prjquota"],"path":"/var/lib/containers","wipeFilesystem":true}]},"systemd":{"units":[{"contents":"# # Generated by Butane\n[Unit]\nRequires=systemd-fsck@dev-disk-by\\x2dpartlabel-var\\x2dlib\\x2dcontainers.service\nAfter=systemd-fsck@dev-disk-by\\x2dpartlabel-var\\x2dlib\\x2dcontainers.service\n\n[Mount]\nWhere=/var/lib/containers\nWhat=/dev/disk/by-partlabel/var-lib-containers\nType=xfs\nOptions=defaults,prjquota\n\n[Install]\nRequiredBy=local-fs.target","enabled":true,"name":"var-lib-containers.mount"}]}} |
| 62 | +---- |
| 63 | +-- |
| 64 | + |
| 65 | +. Use a tool such as link:https://jsonformatter.org/json-pretty-print[JSON Pretty Print] to convert the output into JSON format. |
25 | 66 |
|
26 |
| -. Add the following YAML that describes the host disk partitioning to the `SiteConfig` CR that you use to install the managed cluster: |
| 67 | +. Copy the output into the `.spec.clusters.nodes.ignitionConfigOverride` field in the `SiteConfig` CR. |
27 | 68 | +
|
| 69 | +.Example |
28 | 70 | [source,yaml]
|
29 | 71 | ----
|
30 |
| -nodes: |
31 |
| - rootDeviceHints: |
32 |
| - wwn: "0x62cea7f05c98c2002708a0a22ff480ea" |
33 |
| - diskPartition: |
34 |
| - - device: /dev/disk/by-id/wwn-0x62cea7f05c98c2002708a0a22ff480ea <1> |
35 |
| - partitions: |
36 |
| - - mount_point: /var/imageregistry |
37 |
| - size: 102500 <2> |
38 |
| - start: 344844 <3> |
| 72 | +[...] |
| 73 | +spec: |
| 74 | + clusters: |
| 75 | + - nodes: |
| 76 | + - ignitionConfigOverride: | |
| 77 | + { |
| 78 | + "ignition": { |
| 79 | + "version": "3.2.0" |
| 80 | + }, |
| 81 | + "storage": { |
| 82 | + "disks": [ |
| 83 | + { |
| 84 | + "device": "/dev/disk/by-path/pci-0000:01:00.0-scsi-0:2:0:0", |
| 85 | + "partitions": [ |
| 86 | + { |
| 87 | + "label": "var-lib-containers", |
| 88 | + "sizeMiB": 0, |
| 89 | + "startMiB": 250000 |
| 90 | + } |
| 91 | + ], |
| 92 | + "wipeTable": false |
| 93 | + } |
| 94 | + ], |
| 95 | + "filesystems": [ |
| 96 | + { |
| 97 | + "device": "/dev/disk/by-partlabel/var-lib-containers", |
| 98 | + "format": "xfs", |
| 99 | + "mountOptions": [ |
| 100 | + "defaults", |
| 101 | + "prjquota" |
| 102 | + ], |
| 103 | + "path": "/var/lib/containers", |
| 104 | + "wipeFilesystem": true |
| 105 | + } |
| 106 | + ] |
| 107 | + }, |
| 108 | + "systemd": { |
| 109 | + "units": [ |
| 110 | + { |
| 111 | + "contents": "# # Generated by Butane\n[Unit]\nRequires=systemd-fsck@dev-disk-by\\x2dpartlabel-var\\x2dlib\\x2dcontainers.service\nAfter=systemd-fsck@dev-disk-by\\x2dpartlabel-var\\x2dlib\\x2dcontainers.service\n\n[Mount]\nWhere=/var/lib/containers\nWhat=/dev/disk/by-partlabel/var-lib-containers\nType=xfs\nOptions=defaults,prjquota\n\n[Install]\nRequiredBy=local-fs.target", |
| 112 | + "enabled": true, |
| 113 | + "name": "var-lib-containers.mount" |
| 114 | + } |
| 115 | + ] |
| 116 | + } |
| 117 | + } |
| 118 | +[...] |
39 | 119 | ----
|
40 |
| -<1> This setting depends on the hardware. The setting can be a serial number or device name. The value must match the value set for `rootDeviceHints`. |
41 |
| -<2> The minimum value for `size` is 102500 MiB. |
42 |
| -<3> The minimum value for `start` is 25000 MiB. The total value of `size` and `start` must not exceed the disk size, or the installation will fail. |
| 120 | ++ |
| 121 | +[NOTE] |
| 122 | +==== |
| 123 | +If the `.spec.clusters.nodes.ignitionConfigOverride` field does not exist, create it. |
| 124 | +==== |
43 | 125 |
|
44 |
| -. Save the `SiteConfig` CR and push it to the site configuration repo. |
| 126 | +.Verification |
45 | 127 |
|
46 |
| -The {ztp} pipeline provisions the cluster using the `SiteConfig` CR and configures the disk partition. |
| 128 | +. During or after installation, verify on the hub cluster that the `BareMetalHost` object shows the annotation by running the following command: |
| 129 | ++ |
| 130 | +-- |
| 131 | +[source,terminal] |
| 132 | +---- |
| 133 | +$ oc get bmh -n my-sno-ns my-sno -ojson | jq '.metadata.annotations["bmac.agent-install.openshift.io/ignition-config-overrides"] |
| 134 | +---- |
| 135 | +
|
| 136 | +.Example output |
| 137 | +[source,terminal] |
| 138 | +---- |
| 139 | +"{\"ignition\":{\"version\":\"3.2.0\"},\"storage\":{\"disks\":[{\"device\":\"/dev/disk/by-id/wwn-0x6b07b250ebb9d0002a33509f24af1f62\",\"partitions\":[{\"label\":\"var-lib-containers\",\"sizeMiB\":0,\"startMiB\":250000}],\"wipeTable\":false}],\"filesystems\":[{\"device\":\"/dev/disk/by-partlabel/var-lib-containers\",\"format\":\"xfs\",\"mountOptions\":[\"defaults\",\"prjquota\"],\"path\":\"/var/lib/containers\",\"wipeFilesystem\":true}]},\"systemd\":{\"units\":[{\"contents\":\"# Generated by Butane\\n[Unit]\\nRequires=systemd-fsck@dev-disk-by\\\\x2dpartlabel-var\\\\x2dlib\\\\x2dcontainers.service\\nAfter=systemd-fsck@dev-disk-by\\\\x2dpartlabel-var\\\\x2dlib\\\\x2dcontainers.service\\n\\n[Mount]\\nWhere=/var/lib/containers\\nWhat=/dev/disk/by-partlabel/var-lib-containers\\nType=xfs\\nOptions=defaults,prjquota\\n\\n[Install]\\nRequiredBy=local-fs.target\",\"enabled\":true,\"name\":\"var-lib-containers.mount\"}]}}" |
| 140 | +---- |
| 141 | +-- |
| 142 | +
|
| 143 | +. After installation, check the {sno} disk status. |
| 144 | +
|
| 145 | +.. Enter into a debug session on the {sno} node by running the following command. This step instantiates a debug pod called `<node_name>-debug`: |
| 146 | ++ |
| 147 | +-- |
| 148 | +[source,terminal] |
| 149 | +---- |
| 150 | +$ oc debug node/my-sno-node |
| 151 | +---- |
| 152 | +
|
| 153 | +.. Set `/host` as the root directory within the debug shell by running the following command. The debug pod mounts the host’s root file system in `/host` within the pod. By changing the root directory to `/host`, you can run binaries contained in the host’s executable paths: |
| 154 | ++ |
| 155 | +[source,terminal] |
| 156 | +---- |
| 157 | +# chroot /host |
| 158 | +---- |
| 159 | +
|
| 160 | +.. List information about all available block devices by running the following command: |
| 161 | ++ |
| 162 | +[source,terminal] |
| 163 | +---- |
| 164 | +# lsblk |
| 165 | +---- |
| 166 | ++ |
| 167 | +.Example output |
| 168 | +[source,terminal] |
| 169 | +---- |
| 170 | +NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS |
| 171 | +sda 8:0 0 446.6G 0 disk |
| 172 | +├─sda1 8:1 0 1M 0 part |
| 173 | +├─sda2 8:2 0 127M 0 part |
| 174 | +├─sda3 8:3 0 384M 0 part /boot |
| 175 | +├─sda4 8:4 0 243.6G 0 part /var |
| 176 | +│ /sysroot/ostree/deploy/rhcos/var |
| 177 | +│ /usr |
| 178 | +│ /etc |
| 179 | +│ / |
| 180 | +│ /sysroot |
| 181 | +└─sda5 8:5 0 202.5G 0 part /var/lib/containers |
| 182 | +---- |
| 183 | +
|
| 184 | +.. Display information about the file system disk space usage by running the following command: |
| 185 | ++ |
| 186 | +[source,terminal] |
| 187 | +---- |
| 188 | +# df -h |
| 189 | +---- |
| 190 | ++ |
| 191 | +.Example output |
| 192 | +[source,terminal] |
| 193 | +---- |
| 194 | +Filesystem Size Used Avail Use% Mounted on |
| 195 | +devtmpfs 4.0M 0 4.0M 0% /dev |
| 196 | +tmpfs 126G 84K 126G 1% /dev/shm |
| 197 | +tmpfs 51G 93M 51G 1% /run |
| 198 | +/dev/sda4 244G 5.2G 239G 3% /sysroot |
| 199 | +tmpfs 126G 4.0K 126G 1% /tmp |
| 200 | +/dev/sda5 203G 119G 85G 59% /var/lib/containers |
| 201 | +/dev/sda3 350M 110M 218M 34% /boot |
| 202 | +tmpfs 26G 0 26G 0% /run/user/1000 |
| 203 | +---- |
| 204 | +-- |
0 commit comments