Files
ps5-linux-image/distros/arch/grow-rootfs

15 lines
400 B
Bash

#!/bin/bash
# Grows the root partition and filesystem to fill the disk.
# Runs once on first boot, then disables itself.
set -e
ROOT_DEV=$(findmnt -no SOURCE /)
DISK="/dev/$(lsblk -ndo PKNAME "$ROOT_DEV")"
PART_NUM=$(cat /sys/class/block/$(basename "$ROOT_DEV")/partition)
parted -s "$DISK" resizepart "$PART_NUM" 100%
partprobe "$DISK"
resize2fs "$ROOT_DEV"
systemctl disable grow-rootfs.service