Advertisement
ErwinO1991

Create VDI in TiB from terminal (VBOX)

Jun 14th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.32 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo " You may use, edit and share if you like to, but credit the original creator"
  4. echo "when you share and/or edit this script."
  5. echo ""
  6. echo "WARNING!: By no means, is the script creator liable for any damage"
  7. echo "this script creates, either softwarematic or otherwise."
  8. echo "Use it at your own risk!"
  9. echo ""
  10. sleep 3
  11.  
  12. echo "This script will create a Virtual Harddisk (vdi) in the current"
  13. echo "or provided directory"
  14. echo "Please, put in the amount of TiB you want to use in the X.XX format"
  15. echo "Example: 2.32 or 4.00"
  16. echo ""
  17. echo "[Press ENTER to confirm after input]"
  18. read -r tsize
  19. echo ""
  20. echo "How do you like to name the Harddisk? You can put in a location as well."
  21. echo "Example: HDD.vdi or /home/$USER/My Folder/HDD.vdi"
  22. echo 'WARNING!: Writing locations like "~/" will not work!'
  23. echo ""
  24. echo "[Press ENTER to confirm after input]"
  25. read -r vdi
  26. echo ""
  27. msize=$(echo "$tsize" \* 1048576 | bc)
  28. rsize=${msize::-3}
  29. echo "The $vdi virtual disk with a size of $tsize TiB, or $rsize MiB"
  30. echo "will be created. Do you want to proceed?"
  31. echo ""
  32. select pc in "Proceed" "Cancel"; do
  33.     case $pc in
  34.         Proceed ) VBoxManage createhd --filename "$vdi" --size "$rsize" --variant Standard; echo ""; break;;
  35.         Cancel ) break;;
  36.     esac
  37. done
  38. echo "This script was written by Erwin Oldebesten on 14/06/2017"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement