mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Doc iiab-expand-rootfs + Explicit deps in 1-prep/tasks/hardware.yml
This commit is contained in:
parent
baab781977
commit
85eb059add
2 changed files with 9 additions and 8 deletions
|
@ -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"
|
||||
|
|
|
@ -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 <device>p<partition number>
|
||||
# # e.g. /dev/mmcblk0p2 mounts at / (typical RasPiOS microSD)
|
||||
# # BUT /dev/sda2 mounts at /media/usb1 (RasPiOS USB boot disk...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue