Skip to content

Instantly share code, notes, and snippets.

@seafooler
Created December 14, 2019 08:18
Show Gist options
  • Save seafooler/f83da093ac95866c7fe1dc7a76d45610 to your computer and use it in GitHub Desktop.
Save seafooler/f83da093ac95866c7fe1dc7a76d45610 to your computer and use it in GitHub Desktop.
Enlarge the disk size in vagrant VM

Install vagrant-disksize

vagrant plugin install vagrant-disksize

Modify VagrantFile

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.disksize.size = '80GB'
  ...

Reboot VM

You'd better run vagrant halt && vagrant up rather than vagrant reload

vagrant halt && vagrant up

Partitioning, Formatting, and Mounting the new Disk space

The new disk space is usually in /dev/sda. Thus, partition it as /dev/sda3. You can refer to this blog Partitioning, Formatting, and Mounting a Hard Drive in Linux Ubuntu 18.04 about how to partitioning and formatting. Some important tips about mounting including:

  • Do not mount /dev/sda3 on the /vagrant, which is usually shared with the local OS. Otherwise, we cannot connect to the VM by vagrant ssh directly.
  • A recommended mount point is /mnt/data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment