Last active
May 16, 2019 14:31
-
-
Save W1R3D-Code/a78b746eb2a840b7b28a853d7d2157e1 to your computer and use it in GitHub Desktop.
Resize VirtualBox VM's disk (after being created by Vagrant). commands to run manually, first from windows host then on Linux vm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. First stop the VM | |
# Back up what you can since it never hurts to do so! | |
# 2. convert .vmdk to .vmi and resize to 50G | |
# if not in path VBoxManager is here by default: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe | |
VBoxManage clonehd in.vmdk out.vmi --format VDI | |
VBoxManage modifyhd out.vmi --resize 51200 | |
# 3. Go into VirtualBox settings for VM and remove the old vmdk disk and attach your new vmi in its place | |
# This won't do anything to the disks but its always nice to have backups incase anything goes wrong | |
# 4. Boot up the vm with vagrant and connect via ssh | |
vagrant up | |
vagrant ssh | |
# 5. Resize the partition by deleting & recreating it (changes all get written to disk together, and only after you use w) | |
sudo fdisk /dev/sda1 | |
# p to print partition table | |
# d to delete | |
# n to create new partion, then p for primary > then just use default values | |
# w to write changes to disk and exit | |
# 6. resize file system | |
resize2fs -p -F /dev/sda1 | |
# Done! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment