ading2210 / shimboot

Boot a desktop Linux distribution from a Chrome OS RMA shim.
https://shimboot.ading.dev
GNU General Public License v3.0
87 stars 27 forks source link

New expand_rootfs script not working #60

Open PikaIsNotHere opened 1 week ago

PikaIsNotHere commented 1 week ago

Attempting to run the new expand_rootfs script, it gives an error and it was unable to expand.

Go to XFCE4 terminal Type "sudo expand_rootfs" Profit

I expected rootfs to be expanded.

Log File

ading2210 commented 1 week ago

If anyone else is experiencing this bug, could you test this revised script?

#!/bin/bash

#this script automatically expands the root filesystem

set -e
if [ "$DEBUG" ]; then
  set -x
fi

if [ "$EUID" -ne 0 ]; then
  echo "This needs to be run as root."
  exit 1
fi

part_dev="$(findmnt -T / -no SOURCE)"
disk_dev="$(lsblk --list --noheadings --paths --output PKNAME "$part_dev")"
part_name="$(echo "$part_dev" | rev | cut -d'/' -f1 | rev)"
part_num="$(echo "${part_dev#$disk_dev}" | tr -d 'p')"

echo "Automatically detected root filesystem:"
fdisk -l "$disk_dev" 2>/dev/null | grep "${disk_dev}:" -A 1
echo
echo "Automatically detected root partition:"
fdisk -l "$disk_dev" 2>/dev/null | grep "${part_dev}"
echo
read -p "Press enter to continue, or ctr+c to cancel. "

echo
echo "Before:"
df -h /

echo
echo "Expanding the partition and filesystem..."
growpart "$disk_dev" "$part_num"
resize2fs "$part_dev" 

echo
echo "After:"
df -h /

echo
echo "Done expanding the root filesystem."