Skip to content

Instantly share code, notes, and snippets.

@toddself
Created January 11, 2016 23:35
Show Gist options
  • Save toddself/370ce9297ea0e64b6088 to your computer and use it in GitHub Desktop.
Save toddself/370ce9297ea0e64b6088 to your computer and use it in GitHub Desktop.
  1. stop your vm & backup your disk cp hdd.img hdd-backup.img
  2. resize the disk image hdiutil resize -size [size]g hdd.img
  3. boot into linux and run sudo parted /dev/[disk]
  4. if your swap partition is in the way (located immediately following your primary parition), delete & recreate it
  5. rm [disk id of swap partition]
  6. mkpartfs primary linux-swap
  7. start should be 1 gb away from end of disk
  8. end should be end of disk
  9. save and quit, reboot
  10. verify that the new swap is active swapon -s -- if not then mkswap /dev/[disk][partition id]
  11. you might need to change /etc/fstab to point to the new UUID for the parition. mkswap will return a uuid - replace the current uuid for the swap partition in /etc/fstab with that id
  12. reboot
  13. run sudo parted /dev/[disk]
  14. resizepart [partition id]
  15. keep the same start
  16. end at some number of MB before the swap starts
  17. write to disk
  18. run resize2fs /dev/[disk][parition id]
  19. rejoice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment