From ce6ee5912ca6cdf43387000f0f1081e993099d40 Mon Sep 17 00:00:00 2001 From: Lev Dubinets <3114081+ldub@users.noreply.github.com> Date: Sun, 30 Jun 2019 19:46:36 -0700 Subject: [PATCH] add script to resize VirtualBox disk --- scripts/vbox-resize-disk1.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/vbox-resize-disk1.sh diff --git a/scripts/vbox-resize-disk1.sh b/scripts/vbox-resize-disk1.sh new file mode 100644 index 0000000..4046f5b --- /dev/null +++ b/scripts/vbox-resize-disk1.sh @@ -0,0 +1,24 @@ +set -ex + +DEPLOYMENT="bitcoin-node" +MACHINE="bitcoin-node" +DISK_FILE=$(nixops export -d $DEPLOYMENT | nix-shell -p jq --command "jq -r '..|.\"virtualbox.disks\"?|select(.!=null)' | jq -r .disk1.path") + +nixops stop -d $DEPLOYMENT +VBoxManage modifyhd --resize 307200 "$DISK_FILE" +nixops start -d $DEPLOYMENT + +# ( +# echo d # [d]elete 50gb partition +# echo n # [n]ew partitoin +# echo p # [p]rimary partition +# echo # partition number (Accept default: 1) +# echo # first sector (Accept default: 1) +# echo # last sector (Accept default: 524287999) +# echo w # [w]rite changes +# ) | fdisk +nixops ssh -d $DEPLOYMENT $MACHINE -- '(echo d; echo n; echo p; echo; echo; echo; echo w; ) | fdisk /dev/sda' + +nixops reboot -d $DEPLOYMENT +nixops ssh -d $DEPLOYMENT $MACHINE -- resize2fs /dev/sda1 +nixops ssh -d $DEPLOYMENT $MACHINE -- df -h