Skip to content

Commit

Permalink
Add bigboot and shrink_lv roles (#24)
Browse files Browse the repository at this point in the history
* Add bigboot role

Copy the bigboot role (along with initramfs) as is from its separate repo
Apart from some Jinja formatting only the README and changelog file were added or changed

Signed-off-by: Ygal Blum <[email protected]>

* Add shrink_lv role as is

Add changelog and adjust README files

Signed-off-by: Ygal Blum <[email protected]>

* shrink_lv: use common role initramfs

Signed-off-by: Ygal Blum <[email protected]>

---------

Signed-off-by: Ygal Blum <[email protected]>
  • Loading branch information
ygalblum authored Nov 29, 2023
1 parent 2a932aa commit 5ba0b7c
Show file tree
Hide file tree
Showing 23 changed files with 1,261 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ A reliable snapshot/rollback capability is a key feature required to enable the
These are the roles included in the collection. Follow the links below to see the detailed documentation and example playbooks for each role.

- [`lvm_snapshots`](./roles/lvm_snapshots/) - controls creation and rollback for a defined set of LVM snapshot volumes
- [`bigboot`](./roles/bigboot/) - controls increasing of the boot partition while moving, and shrinking if needed, the adjacent partition
- [`initramfs`](./roles/initramfs/) - controls the atomic flow of building and using a temporary initramfs in a reboot and restoring the original one
- [`shrink_lv`](./roles/shrink_lv/) - controls decreasing logical volume size along with the filesystem

Additional roles are planned to support shrinking logical volumes to make free space available in a volume group and relocating physical volumes to enable increasing the size of a /boot /partition.

Expand Down
3 changes: 3 additions & 0 deletions changelogs/fragments/add-bigboot-role.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
major_changes:
- New role, initramfs, to execute an atomic flow of building and using a temporary initramfs in a reboot and restoring the original one
- New role, bigboot, to increase the boot partition while moving, and shrinking if needed, the adjacent partition
2 changes: 2 additions & 0 deletions changelogs/fragments/add-shrink-lv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
major_changes:
- New role, shrink_lv, to decrease logical volume size along with the filesystem
42 changes: 42 additions & 0 deletions roles/bigboot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# bigboot

The `bigboot` role is used to increase boot partition.

The role is designed to support the automation of RHEL in-place upgrades, but can also be used for other purposes.

## Contents

The role contains the shell scripts to increase the size of the boot partition, as well as the script wrapping it to run as part of the pre-mount step during the boot process.
Finally, there is a copy of the [`sfdisk`](https://man7.org/linux/man-pages/man8/sfdisk.8.html) binary with version `2.38.1` to ensure the extend script will work regardless of the `util-linux` package installed in the target host.

## Role Variables

### `bigboot_size`

The variable `bigboot_size` sets the target size of the boot partition after the role has completed.
The value can be either in bytes or with optional single letter suffix (1024 bases).
See `Unit options` type `iec` of [`numfmt`](https://man7.org/linux/man-pages/man1/numfmt.1.html)


## Example of a playbook to run the role
The following yaml is an example of a playbook that runs the role against a group of hosts named `rhel` and increasing the size of its boot partition by 1G.
The boot partition is automatically retrieved by the role by identifying the existing mounted partition to `/boot` and passing the information to the script using the `kernel_opts`.

```yaml
- name: Extend boot partition playbook
hosts: all
vars:
bigboot_size: 1G
roles:
- bigboot
```
# Validate execution
The script will add an entry to the kernel messages (`/dev/kmsg`) with success or failure and the time it took to process.
In case of failure, it may also include an error message retrieved from the execution of the script.

A successful execution will look similar to this:
```bash
[root@localhost ~]# dmesg |grep pre-mount
[ 357.163522] [dracut-pre-mount] Boot partition /dev/vda1 successfully increased by 1G (356 seconds)
```
1 change: 1 addition & 0 deletions roles/bigboot/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bigboot_size:
Loading

0 comments on commit 5ba0b7c

Please sign in to comment.