add script to resize VirtualBox disk

This commit is contained in:
Lev Dubinets 2019-06-30 19:46:36 -07:00
parent b1835f1c9b
commit ce6ee5912c
No known key found for this signature in database
GPG Key ID: 798E4C6433A5B976

View File

@ -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