From 35427981a0b8a869e52d21e1cef1ac929729a5b0 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Mar 2022 10:24:30 -0400 Subject: [PATCH 01/11] iiab-expand-rootfs for more HW/OS's, per raspi-config's do_expand_rootfs() --- roles/1-prep/README.adoc | 3 +- roles/1-prep/tasks/hardware.yml | 25 +++++++- roles/1-prep/tasks/raspberry_pi.yml | 37 ++++-------- roles/1-prep/templates/iiab-expand-rootfs | 57 +++++++++++++++++++ ...ize.service => iiab-expand-rootfs.service} | 0 roles/1-prep/templates/iiab-rpi-max-rootfs.sh | 41 ------------- 6 files changed, 93 insertions(+), 70 deletions(-) create mode 100644 roles/1-prep/templates/iiab-expand-rootfs rename roles/1-prep/templates/{iiab-rpi-root-resize.service => iiab-expand-rootfs.service} (100%) delete mode 100644 roles/1-prep/templates/iiab-rpi-max-rootfs.sh diff --git a/roles/1-prep/README.adoc b/roles/1-prep/README.adoc index cdbd75142..04bf41db0 100644 --- a/roles/1-prep/README.adoc +++ b/roles/1-prep/README.adoc @@ -14,6 +14,7 @@ username and group, to log into Admin Console * Ubermix (distro) needs /etc/tmpfiles.d/iiab.conf to create essential /var/log subdirs on each boot * *_Hardware actions:_* + ** Install https://github.com/iiab/iiab/blob/master/roles/1-prep/templates/iiab-expand-rootfs[iiab-expand-rootfs] ** link:tasks/raspberry_pi.yml[*_raspberry_pi.yml_*]: *** RTC (real-time clock): install udev rule, configure, enable *** *_Install packages related to:_* @@ -22,8 +23,6 @@ username and group, to log into Admin Console **** fake-hwclock (as RTC is often missing or dead!) **** Wi-Fi *** Increase swap file size - *** https://github.com/iiab/iiab/blob/master/roles/1-prep/templates/iiab-rpi-max-rootfs.sh[rootfs - auto-resizing] ** NUC 6 Wi-Fi firmware Recap: Similar to 0-init, 2-common, 3-base-server, 4 server-options and diff --git a/roles/1-prep/tasks/hardware.yml b/roles/1-prep/tasks/hardware.yml index 2650c7217..c7557da5e 100644 --- a/roles/1-prep/tasks/hardware.yml +++ b/roles/1-prep/tasks/hardware.yml @@ -1,17 +1,38 @@ +- name: Install package 'cloud-guest-utils' so growpart is available for expanding rootfs partition during boot + package: + name: cloud-guest-utils # 2022-03-15: For RasPiOS especially. Ubuntu has still pre-installed, for use with cloud-init. + state: present + +- name: "Install from templates: /usr/sbin/iiab-expand-rootfs, /etc/systemd/system/iiab-expand-rootfs.service" + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + mode: "{{ item.mode }}" + with_items: + - { src: 'iiab-expand-rootfs', dest: '/usr/sbin/', mode: '0755' } + - { src: 'iiab-expand-rootfs.service', dest: '/etc/systemd/system/', mode: '0644' } + +- name: Enable /etc/systemd/system/iiab-expand-rootfs.service + systemd: + name: iiab-expand-rootfs + enabled: yes + + ## DISCOVER PLATFORMS ###### # Put conditional actions for hardware platforms here - include_tasks: raspberry_pi.yml when: first_run and rpi_model != "none" + - name: Check if the identifier for Intel's NUC6 built-in WiFi is present shell: "lsusb | grep 8087:0a2b | wc | awk '{print $1}'" register: usb_NUC6 ignore_errors: True -- name: Download {{ iiab_download_url }}/iwlwifi-8000C-13.ucode to /lib/firmware for built-in WiFi on NUC6 # iiab_download_url is http://download.iiab.io/packages +- name: Download {{ iiab_download_url }}/iwlwifi-8000C-13.ucode to /lib/firmware for built-in WiFi on NUC6 get_url: - url: "{{ iiab_download_url }}/iwlwifi-8000C-13.ucode" + url: "{{ iiab_download_url }}/iwlwifi-8000C-13.ucode" # http://download.iiab.io/packages dest: /lib/firmware timeout: "{{ download_timeout }}" when: usb_NUC6.stdout|int > 0 diff --git a/roles/1-prep/tasks/raspberry_pi.yml b/roles/1-prep/tasks/raspberry_pi.yml index bc54f58af..aa71ff426 100644 --- a/roles/1-prep/tasks/raspberry_pi.yml +++ b/roles/1-prep/tasks/raspberry_pi.yml @@ -39,21 +39,25 @@ meta: noop # 2021-07-27 explanation from @jvonau: The 3 BELOW (iw, rfkill, wireless-tools) -# are provided by RaspiOS. Ubuntu|Debian on the other hand are hit or miss: +# are provided by RasPiOS. Ubuntu|Debian on the other hand are hit or miss: # desktops might have some/all 3 preinstalled, while servers tend not to have # these present at all, but are needed to be installed if you want to take full # advantage of WiFi on Ubuntu and friends -- but it's only enforced on RPi # hardware where we know in advance of the likelihood of WiFi being present. -- name: 'Install packages: cloud-guest-utils, dphys-swapfile, fake-hwclock, iw, rfkill, wireless-tools' +# 2022-03-15: This section is effectively now useless on RasPiOS (but apparently +# serves a purpose on Ubuntu on RPi, where it installs dphys-swapfile and +# fake-hwclock). Still: @jvonau's above explanation of other OS's / other HW +# suggest this code should possibly move in future, to helps others too? + +- name: 'Install packages: dphys-swapfile, fake-hwclock, iw, rfkill, wireless-tools' package: name: - - cloud-guest-utils # Contains 'growpart' for resizing a partition during boot, which is normally done with the aid of cloud-init - - dphys-swapfile # 2021-07-27: RaspiOS installs this regardless -- autogenerate and use a swap file - - fake-hwclock # 2021-07-27: RaspiOS installs this regardless -- save/restore system clock on machines without working RTC hardware - - iw # 2021-07-27: RaspiOS installs this regardless -- configure Linux wireless devices -- hard dependence for ap0 creation, SEE https://github.com/iiab/iiab/blob/master/roles/network/templates/hostapd/iiab-clone-wifi.service.j2 - - rfkill # 2021-07-27: RaspiOS installs this regardless -- enable & disable wireless devices - - wireless-tools # 2021-07-27: RaspiOS installs this regardless -- manipulate Linux Wireless Extensions + - dphys-swapfile # 2021-03-15: For Ubuntu on RPi? RasPiOS installs this regardless -- autogenerate and use a swap file + - fake-hwclock # 2021-03-15: For Ubuntu on RPi? RasPiOS installs this regardless -- save/restore system clock on machines without working RTC hardware + - iw # 2021-07-27: RasPiOS installs this regardless -- configure Linux wireless devices -- hard dependence for ap0 creation, SEE https://github.com/iiab/iiab/blob/master/roles/network/templates/hostapd/iiab-clone-wifi.service.j2 + - rfkill # 2021-07-27: RasPiOS installs this regardless -- enable & disable wireless devices + - wireless-tools # 2021-07-27: RasPiOS installs this regardless -- manipulate Linux Wireless Extensions state: present @@ -68,20 +72,3 @@ systemd: # Had been...a rare/legacy service that was NOT systemd name: dphys-swapfile state: restarted - - -- name: Install RPi rootfs resizing (/usr/sbin/iiab-rpi-max-rootfs.sh) and its systemd service (/etc/systemd/system/iiab-rpi-root-resize.service), from templates (root:root by default) - template: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - #owner: root - #group: root - mode: "{{ item.mode }}" - with_items: - - { src: 'iiab-rpi-max-rootfs.sh', dest: '/usr/sbin/', mode: '0755' } - - { src: 'iiab-rpi-root-resize.service', dest: '/etc/systemd/system/', mode: '0644' } - -- name: Enable RPi rootfs resizing (systemd service iiab-rpi-root-resize.service) - systemd: - name: iiab-rpi-root-resize - enabled: yes diff --git a/roles/1-prep/templates/iiab-expand-rootfs b/roles/1-prep/templates/iiab-expand-rootfs new file mode 100644 index 000000000..baa4623dd --- /dev/null +++ b/roles/1-prep/templates/iiab-expand-rootfs @@ -0,0 +1,57 @@ +#!/bin/bash -x + +# Expand rootfs partition to its maximum size, if /.expand-rootfs exists. +# Used by /etc/systemd/system/iiab-expand-rootfs.service on IIAB boot. + +# Should work with most Linux OS's, regardless whether Raspberry Pi SD cards +# or external USB boot disks, etc. Verifies that rootfs is the last partition. + +if [ -f /.expand-rootfs ] || [ -f /.resize-rootfs ]; then + echo "$0: Expanding rootfs partition" + + if [ -x /usr/bin/raspi-config ]; then + # 2022-02-17: Works in many more situations, e.g. with USB disks (not + # just microSD cards). IF ONLY THIS ALSO WORKED ON Ubuntu/Mint/etc ! + + # Uses do_expand_rootfs() from: + # https://github.com/RPi-Distro/raspi-config/blob/master/raspi-config + raspi-config --expand-rootfs + else + # 2022-03-15: Borrows from above raspi-config URL's do_expand_rootfs() + ROOT_PART="$(findmnt / -o SOURCE -n)" # e.g. /dev/sda2 or /dev/mmcblk0p2 + ROOT_DEV="/dev/$(lsblk -no pkname "$ROOT_PART")" # e.g. /dev/sda or /dev/mmcblk0 + + ROOT_PART_NUM="$(echo "$ROOT_PART" | grep -o "[[:digit:]]*$")" # e.g. 2 + # SLOW (~10 seconds) but it works! + LAST_PART_NUM=$(parted "$ROOT_DEV" -ms unit s p | tail -n 1 | cut -f 1 -d:) + + if [ $ROOT_PART_NUM -ne $LAST_PART_NUM ]; then + echo "ERROR: $ROOT_PART partition ($ROOT_PART_NUM) is not the last partition ($LAST_PART_NUM). Don't know how to expand." + return 0 + fi + + # Expand partition + growpart $ROOT_DEV $ROOT_PART_NUM + resize2fs $ROOT_PART + + # # ASSUMES SD CARD STYLE PARTITION NAME LIKE p + # # e.g. /dev/mmcblk0p2 mounts at / (typical RasPiOS microSD) + # # BUT /dev/sda2 mounts at /media/usb1 (RasPiOS USB boot disk... + # # ...WON'T WORK BELOW; recap @ PR #3121) + + # # Calculate root partition + # root_part=`lsblk -aP -o NAME,MOUNTPOINT | grep 'MOUNTPOINT="/"' | awk -F\" '{ print $2 }'` # e.g. mmcblk0p2 + # root_dev=${root_part:0:-2} # e.g. mmcblk0 + # # bash substring expansion: "negative offset [below, but not above] + # # must be separated from the colon by at least one space to avoid + # # being confused with the ‘:-’ expansion" + # # https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html + # root_part_no=${root_part: -1} # e.g. 2 + + # # Resize partition + # growpart /dev/$root_dev $root_part_no + # resize2fs /dev/$root_part + fi + + rm -f /.expand-rootfs /.resize-rootfs +fi diff --git a/roles/1-prep/templates/iiab-rpi-root-resize.service b/roles/1-prep/templates/iiab-expand-rootfs.service similarity index 100% rename from roles/1-prep/templates/iiab-rpi-root-resize.service rename to roles/1-prep/templates/iiab-expand-rootfs.service diff --git a/roles/1-prep/templates/iiab-rpi-max-rootfs.sh b/roles/1-prep/templates/iiab-rpi-max-rootfs.sh deleted file mode 100644 index 8405727b4..000000000 --- a/roles/1-prep/templates/iiab-rpi-max-rootfs.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -x - -# Resize rootfs and its partition on the RPi SD card (or external USB -# disk if possible, e.g. with Raspberry Pi OS) to maximum size. - -# To be used by /etc/systemd/system/iiab-rpi-root-resize.service on boot. -# Only resizes if /.resize-rootfs exists. -# Assumes root is last partition. - -if [ -f /.resize-rootfs ]; then - echo "$0: maximizing rootfs partion" - - if [ -x /usr/bin/raspi-config ]; then - # 2022-02-17: Works in many more situations, e.g. with USB disks (not - # just microSD cards). IF ONLY THIS ALSO WORKED ON Ubuntu/Mint/etc ! - - # Uses do_expand_rootfs() from: - # https://github.com/RPi-Distro/raspi-config/blob/master/raspi-config - raspi-config --expand-rootfs - else - # ASSUMES SD CARD STYLE PARTITION NAME LIKE p - # e.g. /dev/mmcblk0p2 mounts at / (typical RasPiOS microSD) - # BUT /dev/sda2 mounts at /media/usb1 (RasPiOS USB boot disk... - # ...WON'T WORK BELOW; recap @ PR #3121) - - # Calculate root partition - root_part=`lsblk -aP -o NAME,MOUNTPOINT | grep 'MOUNTPOINT="/"' | awk -F\" '{ print $2 }'` # e.g. mmcblk0p2 - root_dev=${root_part:0:-2} # e.g. mmcblk0 - # bash substring expansion: "negative offset [below, but not above] - # must be separated from the colon by at least one space to avoid - # being confused with the ‘:-’ expansion" - # https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html - root_part_no=${root_part: -1} # e.g. 2 - - # Resize partition - growpart /dev/$root_dev $root_part_no - resize2fs /dev/$root_part - fi - - rm /.resize-rootfs -fi From 334c7089f0ac08898d4d7a78b7b0e886b7f8450e Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Mar 2022 11:00:07 -0400 Subject: [PATCH 02/11] roles/1-prep/README.adoc: hardware.yml & raspberry_pi.yml packages/context --- roles/1-prep/README.adoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/1-prep/README.adoc b/roles/1-prep/README.adoc index 04bf41db0..0d275473b 100644 --- a/roles/1-prep/README.adoc +++ b/roles/1-prep/README.adoc @@ -14,15 +14,15 @@ username and group, to log into Admin Console * Ubermix (distro) needs /etc/tmpfiles.d/iiab.conf to create essential /var/log subdirs on each boot * *_Hardware actions:_* - ** Install https://github.com/iiab/iiab/blob/master/roles/1-prep/templates/iiab-expand-rootfs[iiab-expand-rootfs] + ** Install package cloud-guest-utils for growpart + ** Install https://github.com/iiab/iiab/blob/master/roles/1-prep/templates/iiab-expand-rootfs[iiab-expand-rootfs] that acts on flag `/.expand-rootfs` at boot ** link:tasks/raspberry_pi.yml[*_raspberry_pi.yml_*]: *** RTC (real-time clock): install udev rule, configure, enable - *** *_Install packages related to:_* - **** growpart - **** swapfile + *** *_Install packages:_* + **** dphys-swapfile (for swapfile) **** fake-hwclock (as RTC is often missing or dead!) - **** Wi-Fi - *** Increase swap file size + **** iw, rfkill, wireless-tools (for internal Wi-Fi) + *** Increase swap file size (to `pi_swap_file_size`) ** NUC 6 Wi-Fi firmware Recap: Similar to 0-init, 2-common, 3-base-server, 4 server-options and From cc9a55f13e24d42754e573e6b2eb658fcf383cfe Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Mar 2022 11:05:55 -0400 Subject: [PATCH 03/11] roles/1-prep/README.adoc: Offline hyperlink to templates/iiab-expand-rootfs --- roles/1-prep/README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/1-prep/README.adoc b/roles/1-prep/README.adoc index 0d275473b..fca0f26a6 100644 --- a/roles/1-prep/README.adoc +++ b/roles/1-prep/README.adoc @@ -15,7 +15,7 @@ username and group, to log into Admin Console /var/log subdirs on each boot * *_Hardware actions:_* ** Install package cloud-guest-utils for growpart - ** Install https://github.com/iiab/iiab/blob/master/roles/1-prep/templates/iiab-expand-rootfs[iiab-expand-rootfs] that acts on flag `/.expand-rootfs` at boot + ** Install link:templates/iiab-expand-rootfs[iiab-expand-rootfs] that acts on flag `/.expand-rootfs` at boot ** link:tasks/raspberry_pi.yml[*_raspberry_pi.yml_*]: *** RTC (real-time clock): install udev rule, configure, enable *** *_Install packages:_* From ee765e41d4b2f3977a35de0e9c4f4020039bd9d8 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Mar 2022 11:15:22 -0400 Subject: [PATCH 04/11] 1-prep/templates/iiab-expand-rootfs.service: Fix name iiab-expand-rootfs --- roles/1-prep/templates/iiab-expand-rootfs.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/1-prep/templates/iiab-expand-rootfs.service b/roles/1-prep/templates/iiab-expand-rootfs.service index 2cd33ec11..ffc9bbd9b 100644 --- a/roles/1-prep/templates/iiab-expand-rootfs.service +++ b/roles/1-prep/templates/iiab-expand-rootfs.service @@ -4,7 +4,7 @@ Description=Root Filesystem Auto-Resizer [Service] Environment=TERM=linux Type=oneshot -ExecStart=/usr/sbin/iiab-rpi-max-rootfs.sh +ExecStart=/usr/sbin/iiab-expand-rootfs StandardError=syslog RemainAfterExit=no From baab78197714a686009d3dc5fa8ef3bfd1ff59e6 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Mar 2022 11:47:09 -0400 Subject: [PATCH 05/11] 1-prep/templates/iiab-expand-rootfs: 'exit 1' if partition's not the last --- roles/1-prep/templates/iiab-expand-rootfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/1-prep/templates/iiab-expand-rootfs b/roles/1-prep/templates/iiab-expand-rootfs index baa4623dd..3ea6e51ad 100644 --- a/roles/1-prep/templates/iiab-expand-rootfs +++ b/roles/1-prep/templates/iiab-expand-rootfs @@ -27,7 +27,7 @@ if [ -f /.expand-rootfs ] || [ -f /.resize-rootfs ]; then if [ $ROOT_PART_NUM -ne $LAST_PART_NUM ]; then echo "ERROR: $ROOT_PART partition ($ROOT_PART_NUM) is not the last partition ($LAST_PART_NUM). Don't know how to expand." - return 0 + exit 1 fi # Expand partition From 85eb059addc47b002c4c1c6a8c7d03ace49eaaa1 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Mar 2022 12:17:51 -0400 Subject: [PATCH 06/11] Doc iiab-expand-rootfs + Explicit deps in 1-prep/tasks/hardware.yml --- roles/1-prep/tasks/hardware.yml | 6 ++++-- roles/1-prep/templates/iiab-expand-rootfs | 11 +++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/roles/1-prep/tasks/hardware.yml b/roles/1-prep/tasks/hardware.yml index c7557da5e..77469e6d4 100644 --- a/roles/1-prep/tasks/hardware.yml +++ b/roles/1-prep/tasks/hardware.yml @@ -1,6 +1,8 @@ -- name: Install package 'cloud-guest-utils' so growpart is available for expanding rootfs partition during boot +- name: Install packages 'parted' and 'cloud-guest-utils' (so /usr/bin/growpart is available for expanding rootfs partition during boot) package: - name: cloud-guest-utils # 2022-03-15: For RasPiOS especially. Ubuntu has still pre-installed, for use with cloud-init. + name: + - parted # 2022-03-15: RasPiOS and Ubuntu install this regardless -- so rarely nec but just in case. + - cloud-guest-utils # 2022-03-15: For growpart command, on RasPiOS especially. Ubuntu has this pre-installed, for use with cloud-init. state: present - name: "Install from templates: /usr/sbin/iiab-expand-rootfs, /etc/systemd/system/iiab-expand-rootfs.service" diff --git a/roles/1-prep/templates/iiab-expand-rootfs b/roles/1-prep/templates/iiab-expand-rootfs index 3ea6e51ad..8a208a078 100644 --- a/roles/1-prep/templates/iiab-expand-rootfs +++ b/roles/1-prep/templates/iiab-expand-rootfs @@ -9,14 +9,11 @@ if [ -f /.expand-rootfs ] || [ -f /.resize-rootfs ]; then echo "$0: Expanding rootfs partition" - if [ -x /usr/bin/raspi-config ]; then - # 2022-02-17: Works in many more situations, e.g. with USB disks (not - # just microSD cards). IF ONLY THIS ALSO WORKED ON Ubuntu/Mint/etc ! - - # Uses do_expand_rootfs() from: + if [ -x /usr/bin/raspi-config ]; then # Raspberry Pi OS + # 2022-02-17: Uses do_expand_rootfs() from: # https://github.com/RPi-Distro/raspi-config/blob/master/raspi-config raspi-config --expand-rootfs - else + else # Other Linux OS's # 2022-03-15: Borrows from above raspi-config URL's do_expand_rootfs() ROOT_PART="$(findmnt / -o SOURCE -n)" # e.g. /dev/sda2 or /dev/mmcblk0p2 ROOT_DEV="/dev/$(lsblk -no pkname "$ROOT_PART")" # e.g. /dev/sda or /dev/mmcblk0 @@ -34,6 +31,8 @@ if [ -f /.expand-rootfs ] || [ -f /.resize-rootfs ]; then growpart $ROOT_DEV $ROOT_PART_NUM resize2fs $ROOT_PART + # 2022-03-15: Legacy code below for microSD cards but NOT USB boot disks + # # ASSUMES SD CARD STYLE PARTITION NAME LIKE p # # e.g. /dev/mmcblk0p2 mounts at / (typical RasPiOS microSD) # # BUT /dev/sda2 mounts at /media/usb1 (RasPiOS USB boot disk... From fc032efe8a37ac9740e082a6130003a97344b173 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Mar 2022 12:50:59 -0400 Subject: [PATCH 07/11] iiab-expand-rootfs: ALL kinds of boot disks should work! --- roles/1-prep/templates/iiab-expand-rootfs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/1-prep/templates/iiab-expand-rootfs b/roles/1-prep/templates/iiab-expand-rootfs index 8a208a078..48c8872ba 100644 --- a/roles/1-prep/templates/iiab-expand-rootfs +++ b/roles/1-prep/templates/iiab-expand-rootfs @@ -3,8 +3,10 @@ # Expand rootfs partition to its maximum size, if /.expand-rootfs exists. # Used by /etc/systemd/system/iiab-expand-rootfs.service on IIAB boot. -# Should work with most Linux OS's, regardless whether Raspberry Pi SD cards -# or external USB boot disks, etc. Verifies that rootfs is the last partition. +# Should work with all Linux OS's boot disks -- regardless whether Raspberry Pi +# microSD cards, external USB drives, internal spinning disks or SSD's, etc. + +# Verifies that rootfs is the last partition. if [ -f /.expand-rootfs ] || [ -f /.resize-rootfs ]; then echo "$0: Expanding rootfs partition" From a9fe5902da864352a51a7daccf34b82910f6c7e8 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Mar 2022 12:59:31 -0400 Subject: [PATCH 08/11] iiab-expand-rootfs: Clarify legacy code shortcoming --- roles/1-prep/templates/iiab-expand-rootfs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/1-prep/templates/iiab-expand-rootfs b/roles/1-prep/templates/iiab-expand-rootfs index 48c8872ba..b28838cd0 100644 --- a/roles/1-prep/templates/iiab-expand-rootfs +++ b/roles/1-prep/templates/iiab-expand-rootfs @@ -33,7 +33,8 @@ if [ -f /.expand-rootfs ] || [ -f /.resize-rootfs ]; then growpart $ROOT_DEV $ROOT_PART_NUM resize2fs $ROOT_PART - # 2022-03-15: Legacy code below for microSD cards but NOT USB boot disks + # 2022-03-15: Legacy code below worked with Raspberry Pi microSD cards + # but *not* with USB boot drives, internal spinning disks/SSD's, etc. # # ASSUMES SD CARD STYLE PARTITION NAME LIKE p # # e.g. /dev/mmcblk0p2 mounts at / (typical RasPiOS microSD) From f32b9cec36462dbf647206a92867fd1e99683e47 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Mar 2022 14:38:42 -0400 Subject: [PATCH 09/11] 1-prep/tasks/hardware.yml: Clarify cloud-guest-utils isn't used on RasPiOS --- roles/1-prep/tasks/hardware.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/1-prep/tasks/hardware.yml b/roles/1-prep/tasks/hardware.yml index 77469e6d4..edf9bb284 100644 --- a/roles/1-prep/tasks/hardware.yml +++ b/roles/1-prep/tasks/hardware.yml @@ -2,7 +2,7 @@ package: name: - parted # 2022-03-15: RasPiOS and Ubuntu install this regardless -- so rarely nec but just in case. - - cloud-guest-utils # 2022-03-15: For growpart command, on RasPiOS especially. Ubuntu has this pre-installed, for use with cloud-init. + - cloud-guest-utils # 2022-03-15: For growpart command -- though RasPiOS currently doesn't need this, as raspi-config's do_expand_rootfs() instead uses fdisk. Ubuntu pre-installs cloud-guest-utils, for use with cloud-init. state: present - name: "Install from templates: /usr/sbin/iiab-expand-rootfs, /etc/systemd/system/iiab-expand-rootfs.service" From 212d1fa765887ba3830099dd6bb8f7ffc289f5b1 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Mar 2022 14:52:46 -0400 Subject: [PATCH 10/11] iiab-expand-rootfs: raspi-config uses fdisk instead of growpart --- roles/1-prep/templates/iiab-expand-rootfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/1-prep/templates/iiab-expand-rootfs b/roles/1-prep/templates/iiab-expand-rootfs index b28838cd0..bc81bd302 100644 --- a/roles/1-prep/templates/iiab-expand-rootfs +++ b/roles/1-prep/templates/iiab-expand-rootfs @@ -30,7 +30,7 @@ if [ -f /.expand-rootfs ] || [ -f /.resize-rootfs ]; then fi # Expand partition - growpart $ROOT_DEV $ROOT_PART_NUM + growpart $ROOT_DEV $ROOT_PART_NUM # raspi-config instead uses fdisk resize2fs $ROOT_PART # 2022-03-15: Legacy code below worked with Raspberry Pi microSD cards From 99247671bbf90cdffb9ff9023632196990f82ff5 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Mar 2022 15:15:21 -0400 Subject: [PATCH 11/11] 1-prep/templates/iiab-expand-rootfs.service: Update name --- roles/1-prep/templates/iiab-expand-rootfs.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/1-prep/templates/iiab-expand-rootfs.service b/roles/1-prep/templates/iiab-expand-rootfs.service index ffc9bbd9b..4ac36fa42 100644 --- a/roles/1-prep/templates/iiab-expand-rootfs.service +++ b/roles/1-prep/templates/iiab-expand-rootfs.service @@ -1,5 +1,5 @@ [Unit] -Description=Root Filesystem Auto-Resizer +Description=Root Filesystem Auto-Expander [Service] Environment=TERM=linux