Skip to content

Commit

Permalink
Add bigboot role
Browse files Browse the repository at this point in the history
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 <ygal.blum@gmail.com>
  • Loading branch information
ygalblum committed Nov 29, 2023
1 parent 449840a commit 56973e4
Show file tree
Hide file tree
Showing 14 changed files with 853 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ 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

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
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 56973e4

Please sign in to comment.