Resizing existing VM partition
Use vagrant-disksize plugin from https://github.com/sprotheroe/vagrant-disksize
Set required disk size
Inside Vagrantfile
Vagrant.configure('2') do |config|
config.vm.box = 'ubuntu/xenial64'
config.disksize.size = '100GB'
end
Start Vagrant
vagrant up
or just reload it (if it's already up) with:
vagrant reload
Enter partitioning tool
sudo fdisk /dev/sda3
- Press
p
to check current partitions setup - Press
d
to delete last partition - Press
n
to create new partition - Press
t
to adjust filesystem to match previous settings - Press
p
and make sure that new setup looks similar to the base one (from step 1.) - Press
w
to save settings
You are suppose to see that message:
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
Exit Vagrant
exit
exit
Restart Vagrant
vagrant reload
Enter Vagrant
vagrant ssh
Resize existing partition to span to new available space
sudo resize2fs /dev/sda3
Hopefully it's working now and you have much more free space!