1

I use vagrant create centos virtual machines using the following script:

 Vagrant.configure("2") do |config|
  (2..4).each do |i|
    config.vm.define "node#{i}" do |node|
      node.vm.provider "virtualbox" do |v|
        v.name = "node#{i}"
        v.memory = 3072
        v.cpus = 2
        config.disksize.size = '20GB'
      end
      node.vm.box = "cnode"
      node.vm.hostname = "node#{i}"
      node.vm.network :private_network, ip: "192.168.3.#{i}"
    end
  end
end

But / space is only 8.4GB:

[vagrant@node2 opt]$ df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  8.4G  1.1G  7.4G  13% /
devtmpfs                 1.4G     0  1.4G   0% /dev
tmpfs                    1.4G     0  1.4G   0% /dev/shm
tmpfs                    1.4G  8.3M  1.4G   1% /run
tmpfs                    1.4G     0  1.4G   0% /sys/fs/cgroup
/dev/sda1                497M  118M  379M  24% /boot
none                     234G  148G   87G  64% /vagrant
Yao Pan
  • 524
  • 9
  • 26

1 Answers1

0

config.disksize.size is a parameter from the 3rd party https://github.com/sprotheroe/vagrant-disksize

As mentioned in the README :

Depending on the guest, you may need to resize the partition and the filesystem from within the guest. At present the plugin only resizes the underlying disk.

you can refer to vagrant no space left on device for the steps on the resizing partition

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139