Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Switch to LVM thin provisioning
Browse files Browse the repository at this point in the history
This change switches all LVM volumes being backed by a single thin
provisioning[1] pool.

This will allow day-2 operations to use spare physical space for
things such as:
- backups during a major upgrade on an ephemeral volume
- extending /srv or /var due to inaccurate storage capacity planning

This change enables the fstrim.timer unit on a daily schedule so that
the thin provisioning layer is notified of freed blocks.

[1] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/configuring_and_managing_logical_volumes/creating-and-managing-thinly-provisioned-volumes_configuring-and-managing-logical-volumes

Change-Id: Id1c7e627b67b930347eed040176a9737cabc87d0
Depends-On: https://review.opendev.org/c/openstack/diskimage-builder/+/840144
  • Loading branch information
steveb committed Aug 31, 2022
1 parent 865bf26 commit 304e4d1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
19 changes: 19 additions & 0 deletions elements/overcloud-partition-uefi/block-device-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,46 @@
base: [ "pv" ]
options: [ "--force" ]
lvs:
- name: lv_thinpool
type: thin-pool
base: vg
# 20MiB overhead from root partition size
size: 5044MiB
- name: lv_root
type: thin
thin-pool: lv_thinpool
base: vg
# Volume sizes should be a multiple of 4MiB (1 LVM extent)
# so this is rounded down from 3706MiB
size: 3704MiB
- name: lv_tmp
type: thin
thin-pool: lv_thinpool
base: vg
size: 240MiB
- name: lv_var
type: thin
thin-pool: lv_thinpool
base: vg
size: 952MiB
- name: lv_log
type: thin
thin-pool: lv_thinpool
base: vg
size: 240MiB
- name: lv_audit
type: thin
thin-pool: lv_thinpool
base: vg
size: 192MiB
- name: lv_home
type: thin
thin-pool: lv_thinpool
base: vg
size: 240MiB
- name: lv_srv
type: thin
thin-pool: lv_thinpool
base: vg
size: 48MiB
- mkfs:
Expand Down
11 changes: 11 additions & 0 deletions elements/overcloud-partition-uefi/post-install.d/80-enable-fstrim
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail

sed -i "/^OnCalendar=/c\OnCalendar=daily" /usr/lib/systemd/system/fstrim.timer
sed -i "/^Description=/c\Description=Discard unused blocks once a day" /usr/lib/systemd/system/fstrim.timer
systemctl enable fstrim.timer

0 comments on commit 304e4d1

Please sign in to comment.