Skip to content

Instantly share code, notes, and snippets.

@simt2
Last active December 23, 2021 05:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simt2/8178ea232c4ebbae3c88cfbd3e6b146d to your computer and use it in GitHub Desktop.
Save simt2/8178ea232c4ebbae3c88cfbd3e6b146d to your computer and use it in GitHub Desktop.
Adding an additional disk to a VirtualBox machine in Vagrant via the experimental disks feature
# Enable the experimental disks feature via environment variable, requires Vagrant >=2.2.8.
ENV["VAGRANT_EXPERIMENTAL"] = "disks"
Vagrant.configure(2) do |config|
config.vm.disk :disk, name: "storage", size: "4GB"
end
Copy link

ghost commented Dec 21, 2020

i copy pasted the line but i am getting an error:
VirtualBox Provider:

  • The following settings shouldn't exist: disk

@simt2
Copy link
Author

simt2 commented Dec 21, 2020

i copy pasted the line but i am getting an error:
VirtualBox Provider:

  • The following settings shouldn't exist: disk

Did you also copy the first line? The environment variable VAGRANT_EXPERIMENTAL needs to be set to disks to enable this feature.

@hholzgra
Copy link

Same problem here, VAGRANT_EXPERIMENTAL=disks set both in shell environment and in the Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

ENV["VAGRANT_EXPERIMENTAL"] = "disks"

Vagrant.configure("2") do |config|
  config.vm.provider :virtualbox
  config.vm.box = "ubuntu/focal64"

  config.vm.disk :disk, name: "backup", size: "10GB"
end

Output:

==> vagrant: You have requested to enabled the experimental flag with the following features:
==> vagrant: 
==> vagrant: Features:  disks
==> vagrant: 
==> vagrant: Please use with caution, as some of the features may not be fully
==> vagrant: functional yet.
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The following settings shouldn't exist: disk

Versions:

Vagrant 2.2.6
VirtualBox 6.1.16
Host OS: Ubuntu 20.04.2 LTS

Copy link

ghost commented Feb 26, 2021

yes - i did.

@hholzgra
Copy link

It seems to be a version issue, "disks" was only added somewhere between 2.2.6 (what comes with Ubuntu 20.04LTS) and 2.2.14 (latest from HashiCopr) it seems. Too bad the documentation does not seem to bother to mention this :(

@simt2
Copy link
Author

simt2 commented Mar 1, 2021

The feature was added with Vagrant 2.2.8, I recommend to always track the newest stable via the debian package on the Downloads page. One might think that the message implies that the feature is already included, but that's apparently not how experimental features work - they're experimental after all :-)

@hholzgra
Copy link

hholzgra commented Mar 1, 2021

Well, I'd says that's not how documentation should work, it should always tell what exact versions a feature is actually available in ... but maybe I'm spoiled by all the hours I spent on automating that for all the function reference pages the PHP manual back in the days ;)

@simt2
Copy link
Author

simt2 commented Mar 2, 2021

@hholzgra not sure what you're getting at. It's in the changelog and I'm pretty sure it's not included in the documentation before 2.2.8. I'll include it in this gist for other people finding this although it is just an unofficial example/note by myself.

@hholzgra
Copy link

hholzgra commented Mar 2, 2021

I'm referring to https://www.vagrantup.com/docs/disks/usage ... no "Available starting with Vx.y.z" info there at all. Not complaining about your example, but about the way Vagrant online documentation is organized ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment