diff --git a/Makefile b/Makefile index 42ab249..67af96d 100644 --- a/Makefile +++ b/Makefile @@ -237,6 +237,7 @@ install-common: install -m 0644 qubes-rpc/qubes.GetImageRGBA $(DESTDIR)/etc/qubes-rpc install -m 0644 qubes-rpc/qubes.SetDateTime $(DESTDIR)/etc/qubes-rpc install -m 0755 qubes-rpc/qubes.InstallUpdatesGUI $(DESTDIR)/etc/qubes-rpc + install -m 0755 qubes-rpc/qubes.ResizeDisk $(DESTDIR)/etc/qubes-rpc install -d $(DESTDIR)/etc/qubes/suspend-pre.d install -m 0644 qubes-rpc/suspend-pre.README $(DESTDIR)/etc/qubes/suspend-pre.d/README diff --git a/qubes-rpc/qubes.ResizeDisk b/qubes-rpc/qubes.ResizeDisk new file mode 100755 index 0000000..a1ad8b1 --- /dev/null +++ b/qubes-rpc/qubes.ResizeDisk @@ -0,0 +1,32 @@ +#!/bin/sh + +read 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 + new_size=$(cat /sys/block/xvda/size) + ro=$(/sys/block/xvda/ro) + if [ $ro -eq 1 ]; then + new_table="0 $new_size snapshot /dev/xvda /dev/xvdc2 N 16" + else + new_table="0 $new_size linear /dev/xvda 0" + fi + dmsetup load dmroot --table "$new_table" + dmsetup resume dmroot + resize2fs /dev/mapper/dmroot + ;; + *) + echo "Automatic resize of '$disk_name' not supported" >&2 + exit 1 + ;; +esac + diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index bca5102..8c6fcb8 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -350,6 +350,7 @@ rm -f %{name}-%{version} %config(noreplace) /etc/qubes-rpc/qubes.GetImageRGBA %config(noreplace) /etc/qubes-rpc/qubes.SetDateTime %config(noreplace) /etc/qubes-rpc/qubes.InstallUpdatesGUI +%config(noreplace) /etc/qubes-rpc/qubes.ResizeDisk %dir /etc/qubes/autostart /etc/qubes/autostart/README.txt %config /etc/qubes/autostart/*.desktop.d/30_qubes.conf