1
1
mirror of https://github.com/OpenVoiceOS/OpenVoiceOS synced 2024-12-29 10:11:40 +01:00
OpenVoiceOS/buildroot-external/package/growdisk-service/growdisk
j1nx 6a59dcb1e1 [DONE] Implementation of own growdisk architecture.
This is temporarily till we switch to A/B mirrored rootfs
and data-overlay for all writable mounts.
2021-02-04 09:45:00 +01:00

25 lines
646 B
Bash
Executable File

#!/bin/bash
#
# Get active block device
DEVICE_ROOTFS="$(findfs UUID=c0932a41-44cf-463b-8152-d43188553ed4)"
DEVICE="/dev/$(lsblk -no pkname "${DEVICE_ROOTFS}")"
# Fix GPT header backup file
sgdisk -e "${DEVICE}" &&
partprobe "${DEVICE}" &&
# Resize needed?
UNUSED=$(sfdisk -Fq "${DEVICE}" | cut -d " " -f 3 | tail -1)
if [ -z "${UNUSED}" ] || [ "${UNUSED}" -le "16384" ]; then
echo "[INFO] No resize of rootfs partition needed"
exit 0
else
echo "[INFO] Resizing the rootfs partition"
parted "${DEVICE}" unit % resizepart 2 100% &&
partprobe "${DEVICE}" &&
sync &&
resize2fs "${DEVICE_ROOTFS}" &&
echo "[OK]"
fi