From a59ac1b4f958dec263dc605fb8db37e6d915a9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 2 Oct 2017 19:42:00 +0200 Subject: [PATCH] qubes.ResizeDisk: handle dmroot being a symlink In non-template-based-VMs it can be just a symlink (depending on initramfs version). --- qubes-rpc/qubes.ResizeDisk | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/qubes-rpc/qubes.ResizeDisk b/qubes-rpc/qubes.ResizeDisk index 0ac0656..038467d 100755 --- a/qubes-rpc/qubes.ResizeDisk +++ b/qubes-rpc/qubes.ResizeDisk @@ -13,15 +13,17 @@ case $disk_name in 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" + if [ "$(stat -Lc %t /dev/mapper/dmroot)" != "ca" ]; then + 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 fi - dmsetup load dmroot --table "$new_table" - dmsetup resume dmroot resize2fs /dev/mapper/dmroot ;; *)