Skip to content

Instantly share code, notes, and snippets.

@W1R3D-Code
Last active May 16, 2019 14:31
Show Gist options
  • Select an option

  • Save W1R3D-Code/a78b746eb2a840b7b28a853d7d2157e1 to your computer and use it in GitHub Desktop.

Select an option

Save W1R3D-Code/a78b746eb2a840b7b28a853d7d2157e1 to your computer and use it in GitHub Desktop.

Revisions

  1. W1R3D-Code revised this gist May 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion resize-vmi
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ VBoxManage modifyhd out.vmi --resize 51200
    vagrant up
    vagrant ssh

    # 5. Resize the partition by deleting & recreating it (actions only happens when you write them back with w)
    # 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
  2. W1R3D-Code revised this gist May 16, 2019. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions resize-vmi
    Original file line number Diff line number Diff line change
    @@ -9,15 +9,19 @@ 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. Resize the partition by deleting & recreating it (actions only happens when you write them back with w)
    # 4. Boot up the vm with vagrant and connect via ssh
    vagrant up
    vagrant ssh

    # 5. Resize the partition by deleting & recreating it (actions only happens when you write them back with 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

    # 5. resize file system
    # 6. resize file system
    resize2fs -p -F /dev/sda1

    # Done!
  3. W1R3D-Code created this gist May 16, 2019.
    23 changes: 23 additions & 0 deletions resize-vmi
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    # 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. Resize the partition by deleting & recreating it (actions only happens when you write them back with 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

    # 5. resize file system
    resize2fs -p -F /dev/sda1

    # Done!