core-agent-linux/qubes-rpc/qubes.ResizeDisk
Marek Marczykowski-Górecki d8a2b8c375
Add support for new root volume partition layout to qubes.ResizeDisk
If root filesystem is the last partition (new layout), resize it
in-place. Use 'parted' tool because it can resize just one partition,
without need to specify the whole new partition table. Since the
partition is mounted, parted is unhappy to modify it. Force it by
answering to its interactive prompts, and add (apparently not
documented) ---pretend-input-tty to use those answers even
though stdin is not a tty. Split the operation into multiple parted
calls, for more reliable interactive prompts handling.

Qubes 3.x disk layout (no partition table) is also supported, but the
one that was used in Qubes 4.0 rc1 (root filesystem as the first
partition) is not.

Fixes QubesOS/qubes-issues#3173
QubesOS/qubes-issues#3143
2017-10-18 19:53:48 +02:00

23 rivejä
439 B
Bash
Executable File

#!/bin/sh
read -r disk_name
set -e
case $disk_name in
private)
# force some read to refresh device size
head /dev/xvdb > /dev/null
resize2fs /dev/xvdb
;;
root)
# force some read to refresh device size
head /dev/xvda > /dev/null
/usr/lib/qubes/resize-rootfs
;;
*)
echo "Automatic resize of '$disk_name' not supported" >&2
exit 1
;;
esac