Git Product home page Git Product logo

vagrant-persistent-storage's Introduction

Vagrant::Persistent-Storage

A Vagrant plugin that creates a persistent storage and attaches it to guest machine.

Requires Virtualbox 5/6

Installation

$ vagrant plugin install vagrant-persistent-storage

Usage

After installing you can set the location and size of the persistent storage.

The following options will create a persistent storage with 5000 MB, named mysql, mounted on /var/lib/mysql, in a volume group called 'myvolgroup'

config.persistent_storage.enabled = true
config.persistent_storage.location = "~/development/sourcehdd.vdi"
config.persistent_storage.size = 5000
config.persistent_storage.mountname = 'mysql'
config.persistent_storage.filesystem = 'ext4'
config.persistent_storage.mountpoint = '/var/lib/mysql'
config.persistent_storage.volgroupname = 'myvolgroup'

With config.persistent_storage.mountoptions you can change the mount options (default: defaults). An example which sets prjquota option with xfs.

config.persistent_storage.mountname    = 'xfs'
config.persistent_storage.filesystem   = 'xfs'
config.persistent_storage.mountpoint   = '/mnt/xfs'
config.persistent_storage.mountoptions = ['defaults', 'prjquota']

Device defaults to /dev/sdb. For boxes with multiple disks, make sure you increment the drive:

config.persistent_storage.diskdevice = '/dev/sdc'

If you are using LVM and you would prefer to use the disk rather than a partition, you can set the following configuration:

config.persistent_storage.partition = false

When you expect a lot of writes in the disk (the case for /home mountpoints) it is recommended to change the disk variant to Fixed (fixed allocation) instead of the default Standard (dyanamic allocation). The tested types are Standard (default) and Fixed.

config.persistent_storage.variant    = 'Fixed'

If you want to pass a list of options to the underlying VboxManage storageattach call, you can use the config.persistent_storage.attachoptions option. For instance, if you want to enable TRIM support:

config.persistent_storage.mountoptions = ['defaults', 'discard']
config.persistent_storage.attachoptions = ['--discard', 'on']

Every vagrant up will attach this file as hard disk to the guest machine. A vagrant destroy will detach the storage to avoid deletion of the storage by vagrant. A vagrant destroy generally destroys all attached drives. See VBoxManage unregistervm --delete option.

The disk is initialized and added to it's own volume group as specfied in the config; this defaults to 'vagrant'. An ext4 filesystem is created and the disk mounted appropriately, with entries added to fstab ... subsequent runs will mount this disk with the options specified.

Windows Guests

Windows Guests must use the WinRM communicator by setting vm.communicator = 'winrm'. An additional option is provided to allow you to set the drive letter using:

config.persistent_storage.drive_letter = 'Z'

Options that are irrelevent to Windows are ignored, such as mountname, filesystem, mountpoint and volgroupname.

How Is The Storage Created?

Based on the configuration provided, during a vagrant up a bash script is generated and uploaded to $tmpdir/disk_operations_#{mnt_name}.sh (Linux) or disk_operations_#{mnt_name}.ps1 (Windows). If the box has not been previously provisioned the script is executed on a vagrant up. To force the script to be executed again you can run vagrant provision or if you have halted the box, vagrant up --provision.

The outcome of the script being run is placed in the home drive of the vagrant user in a file called disk_operation_log.txt.

Optional settings

config.persistent_storage.part_type_code = '82'

Troubleshooting

If your box is not using LVM you must set config.persistent_storage.use_lvm = false.

Supported Providers

  • Only the VirtualBox provider is supported.

Contributors

TODO

  • There's Always Something to Do
  • Add more options (controller, port, etc.)

vagrant-persistent-storage's People

Contributors

aishahalim avatar apyrgio avatar azbarcea avatar benphegan avatar bucatzel avatar dictcp avatar dimara avatar dsmaher avatar fredleger avatar henryne avatar hiboma avatar jeremiahsnapp avatar joshuata avatar k2s avatar kusnier avatar lhupfeldt avatar madandroid avatar marsup avatar mpuels avatar philsc avatar qdetweiler avatar saranrapjs avatar symaxion avatar tomkins avatar tyuio9 avatar verdurin avatar vvavrychuk avatar windperson avatar wwtreese avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vagrant-persistent-storage's Issues

IDE Controller bad port selection

Hi,
I see that in new release the default port for IDE Controller was changed to 4.
I know that it causes issues for some users, where IDE Controller only support ports 0 and 1.
I hope the problem will be addressed.
Cheers.

Multiple VMS

Hi,

How can we do if we got multiple VMs?

Thanks

All arguments must be a string

i am receiving this error

/Applications/Vagrant/embedded/gems/gems/childprocess-0.5.3/lib/childprocess/abstract_process.rb:45:in `initialize': all arguments must be String: ["/usr/bin/VBoxManage", "storageattach", "9f581582-5d45-4d46-8308-26e4f4c0020c", "--storagectl", nil, "--port", "1", "--device", "0", "--type", "hdd", "--medium", "/Users/tmcbrearty/Vagrant/boxes/additional-storage.vdi"] (ArgumentError)

Vagrantfile

db.persistent_storage.enabled = 'true'
        db.persistent_storage.location = "/Users/tmcbrearty/Vagrant/boxes/additional-storage.vdi"
        db.persistent_storage.size = '30000'
        db.persistent_storage.mountname = 'mysql'
        db.persistent_storage.filesystem = 'ext4'
        db.persistent_storage.mountpoint = '/var/lib/mysql'
        db.persistent_storage.volgroupname = 'mydatabase'

I'm' running vagrant 1.6.3
and virtualbox 4.3.12

Not sure how to get past this.

Thanks,

Destroying a vm with no persistent storage attached fails with stacktrace

I added the plugin with a vm already booted up and destroying it resulted in:

/home/user/.vagrant.d/gems/2.2.5/gems/vagrant-persistent-storage-0.0.24/lib/vagrant-persistent-storage/providers/virtualbox/driver/base.rb:68:in `realpath': No such file or directory @ realpath_rec - /path/to/vagrant-data.vdi (Errno::ENOENT)
	from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-persistent-storage-0.0.24/lib/vagrant-persistent-storage/providers/virtualbox/driver/base.rb:68:in `realpath'
	from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-persistent-storage-0.0.24/lib/vagrant-persistent-storage/providers/virtualbox/driver/base.rb:68:in `identical_files'
	from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-persistent-storage-0.0.24/lib/vagrant-persistent-storage/providers/virtualbox/driver/base.rb:60:in `block in read_persistent_storage'
	from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-persistent-storage-0.0.24/lib/vagrant-persistent-storage/providers/virtualbox/driver/base.rb:56:in `each'
	from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-persistent-storage-0.0.24/lib/vagrant-persistent-storage/providers/virtualbox/driver/base.rb:56:in `read_persistent_storage'
	from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-persistent-storage-0.0.24/lib/vagrant-persistent-storage/providers/virtualbox/driver/base.rb:44:in `detach_storage'
	from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-persistent-storage-0.0.24/lib/vagrant-persistent-storage/action/detach_storage.rb:25:in `call'

DUPLICATE of #16: Variable handling incompatible with vagrant 1.5

After updating vagrant to 1.5, performing a vagrant up results in the following:

/Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/plugin/v2/config.rb:73:in `method_missing': undefined local variable or method `mount_point' for #<VagrantPlugins::PersistentStorage::Config:0x000001012d5b70> (NameError)
    from /Users/*****/.vagrant.d/gems/gems/vagrant-persistent-storage-0.0.10/lib/vagrant-persistent-storage/config.rb:118:in `validate'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/config/v2/root.rb:68:in `block in validate'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/config/v2/root.rb:64:in `each'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/config/v2/root.rb:64:in `validate'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/builtin/config_validate.rb:15:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/builtin/call.rb:57:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/runner.rb:69:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/runner.rb:69:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/machine.rb:157:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/batch_action.rb:72:in `block (2 levels) in run'

Two persistent storage mounts fail on startup

When following the example in the readme, everything works as expected. However when I add an additional persistent storage config, my first config fails during VM boot. Removing the second and rebooting succeeds.

I'm running vagrant-persistent-storage 0.0.12 on Windows 7 x64, Vagrant 1.6.3.

'The disk drive for /var/lib/mysql is not ready or not present.
Continue to wait, or Press S to skip mounting or M for manual recovery'

Redacted config:
config.persistent_storage.enabled = true
config.persistent_storage.location = '\mysql.vdi'
config.persistent_storage.size = 5000
config.persistent_storage.manage = true
config.persistent_storage.mountname = 'mysql'
config.persistent_storage.filesystem = 'ext4'
config.persistent_storage.mountpoint = '/var/lib/mysql'

config.persistent_storage.enabled = true
config.persistent_storage.location = '\files.vdi'
config.persistent_storage.size = 5000
config.persistent_storage.manage = true
config.persistent_storage.mountname = 'my_files'
config.persistent_storage.filesystem = 'ext4'
config.persistent_storage.mountpoint = '/var/lib/my_files'

failed to create disk with specified size for ubuntu 16.04

Using the following Vagrantfile:

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

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "ubuntu/xenial64"

  # The url from where the 'config.vm.box' box will be fetched if it
  # doesn't already exist on the user's system.
  config.vm.box_url = "http://files.vagrantup.com/xenial64.box"

  # configure a persistent storage for mysql data
  config.persistent_storage.enabled = true
  config.persistent_storage.location = "virtualdrive.vdi"
  config.persistent_storage.size = 5000
  config.persistent_storage.mountname = 'mysql'
  config.persistent_storage.filesystem = 'ext4'
  config.persistent_storage.mountpoint = '/var/lib/mysql'
  config.persistent_storage.volgroupname = 'myvolgroup'

end

checking the PV inside:

ubuntu@ubuntu-xenial:~$ sudo pvdisplay 
sudo: unable to resolve host ubuntu-xenial
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               myvolgroup
  PV Size               9.00 MiB / not usable 0   
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              2
  Free PE               0
  Allocated PE          2
  PV UUID               8aBRG9-tFfk-TpWE-a3Wk-RH4m-s5iE-SLp2y4

I presume because the ubuntu/xenial64 box has already 2 disks.

Controller 'IDE Controller' does not support hotplugging

I use box 'puphpet/centos65-x64' and configured persist storage

config.persistent_storage.enabled = true
config.persistent_storage.location = "./persiststorage.vdi"
config.persistent_storage.size = 5000
config.persistent_storage.mountname = 'mysql'
config.persistent_storage.filesystem = 'ext4'
config.persistent_storage.mountpoint = '/var/lib/mysql'
config.persistent_storage.volgroupname = 'persiststoragevolgroup'

but during vagrant halt I get error

There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The stderr is shown below.

Command: ["storageattach", "ebf318a0-ca7d-43d5-a2c7-3ab294a5ca1a", "--storagectl", "IDE Controller", "--port", "1", "--device", "0", "--type", "hdd", "--medium", "none"]

Stderr: VBoxManage.exe: error: Controller 'IDE Controller' does not support hotplugging
VBoxManage.exe: error: Details: code VBOX_E_INVALID_VM_STATE (0x80bb0002), component SessionMachine, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "DetachDevice(Bstr(pszCtl).raw(), port, device)" at line 393 of file   VBoxManageStorageController.cpp

VBoxManage.exe showvminfo shows following info about storage controllers

storagecontrollername0="IDE Controller"
storagecontrollertype0="PIIX4"
storagecontrollerinstance0="0"
storagecontrollermaxportcount0="2"
storagecontrollerportcount0="2"
storagecontrollerbootable0="on"
"IDE Controller-0-0"="C:\Users\Vasyl.Vavrychuk\VirtualBox VMs\phabricator_default_1447673535275_94503\packer-virtualbox-iso-1422577590-disk1.vmdk"
"IDE Controller-ImageUUID-0-0"="07ee4f1d-a469-4c27-afa4-b82e604b3305"
"IDE Controller-0-1"="none"
"IDE Controller-1-0"="c:\kom\vagrant\phabricator\.\persiststorage.vdi"
"IDE Controller-ImageUUID-1-0"="275904e9-b645-4f19-9835-7dd29c413486"
"IDE Controller-1-1"="none"

Stderr: VBoxManage: error: Could not find a controller named 'SATA Controller'

I have installed this plugin , but still i am facing the same issue.
Environment:

Host machine : OSX
Vagrant Version : Latest Version: 1.7.2
Vagrant Box image : hansode/centos-6.5-x86_64

$ vagrant plugin list
vagrant-persistent-storage (0.0.15)
vagrant-share (1.1.3, system)
$

==> osd0: Running 'pre-boot' VM customizations...
A customization command failed:

["storageattach", :id, "--storagectl", "SATA Controller", "--port", 0, "--device", 0, "--type", "hdd", "--medium", "disk-0-0.vdi"]

The following error was experienced:

<Vagrant::Errors::VBoxManageError: There was an error while executing VBoxManage, a CLI used by Vagrant

for controlling VirtualBox. The command and stderr is shown below.

Command: ["storageattach", "2613dc11-8637-419e-8b2f-e40d1973dbe2", "--storagectl", "SATA Controller", "--port", "0", "--device", "0", "--type", "hdd", "--medium", "disk-0-0.vdi"]

Stderr: VBoxManage: error: Could not find a controller named 'SATA Controller'

Please fix this customization and try again.
$

Volume crashes on reload when using LVM

Host: Mac OS 10.8 and Ubuntu 14.04 64-bit
Box: Ubuntu 14.04 32-bit
Vagrant: 1.6.2
vagrant-persistent-storage: 0.0.12

file_to_disk = File.dirname(__FILE__) + '/data.vdi'

Vagrant.configure("2") do |config|
  config.vm.box = "trusty32"  #Box Name
  config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-i386-vagrant-disk1.box" #Box Location

  config.persistent_storage.enabled = true
  config.persistent_storage.location = file_to_disk
  config.persistent_storage.size = 50000
  config.persistent_storage.mountname = 'data'
  config.persistent_storage.filesystem = 'ext4'
  config.persistent_storage.mountpoint = '/media/data'
  config.persistent_storage.volgroupname = 'vg_data'

  config.vm.provider :virtualbox do |virtualbox|
    virtualbox.customize ["modifyvm", :id, "--ioapic", "on"]
    virtualbox.memory = 2048
    virtualbox.cpus = 2
  end

  config.ssh.forward_agent = true
  config.vm.network :private_network, ip: "x.x.x.x"

end

When doing a vagrant reload, the disk gets corrupted, it hangs on boot, saying the disk is not ready, the device is not recognized when mounting manually and the data is gone if I reinitialize the disk (obviously).

I solved my problem by disabling lvm:

  config.persistent_storage.use_lvm = false

Error: check_version_conflict': can't activate childprocess-0.3.9, already activated childprocess-0.5.9

On OSX:

$ brew cask install virtualbox
$ brew cask install vagrant
$ vagrant plugin install vagrant-persistent-storage
Installing the 'vagrant-persistent-storage' plugin. This can take a few minutes...
/opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/specification.rb:2100:in `check_version_conflict': can't activate childprocess-0.3.9, already activated childprocess-0.5.9 (Gem::LoadError)
	from /opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/specification.rb:1276:in `activate'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/bundler.rb:319:in `block in activate_solution'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/bundler.rb:316:in `each'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/bundler.rb:316:in `activate_solution'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/bundler.rb:244:in `internal_install'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/bundler.rb:97:in `install'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/manager.rb:62:in `block in install_plugin'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/manager.rb:72:in `call'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/manager.rb:72:in `install_plugin'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/plugin/action/install_gem.rb:37:in `call'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:34:in `call'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/builder.rb:116:in `call'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/runner.rb:66:in `block in run'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/util/busy.rb:19:in `busy'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/runner.rb:66:in `run'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/plugin/command/base.rb:14:in `action'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/plugin/command/install.rb:32:in `block in execute'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/plugin/command/install.rb:31:in `each'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/plugin/command/install.rb:31:in `execute'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/plugin/command/root.rb:66:in `execute'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/cli.rb:42:in `execute'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/environment.rb:308:in `cli'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/bin/vagrant:123:in `<main>'

For 2 Disks VM - its replacing the second disk

i have a vagrant box with 2 disks, if i use this plugin to add one more disk it replacing the second disk which in-turns causing vm crash, do you have any options for this i tried with diskdevice="/dev/sdc" but no luck

Using a relative path for `persistent_storage.location` causes `detach_storage` failure

When I specify a relative path for persistent_storage.location, like so:

config.persistent_storage.location = "boxes/db.vdi"

The end result, upon running vagrant destroy, is that the drive does not unmount, and so the drive is deleted.

It looks like inside the VirtualBox detach_storage method, there's a comparison of the location as set in the Vagrantfile, and the location as reported by showvminfo:

https://github.com/kusnier/vagrant-persistent-storage/blob/master/lib/vagrant-persistent-storage/providers/virtualbox/driver/base.rb#L19

This fails because the one path is relative (persistent_storage.location), and the other path is absolute (showvminfo).

I'm not very familiar with Ruby, but my guess is that if an absolute path version of the persistent_storage.location was used instead, detach_storage would succeed?

Can't Delete VDI

Is there an option to delete the vdi on vagrant destroy?

If I do vagrant destroy, delete the vdi on the host, then do vagrant up I get the following error:

==> default: ** Creating persistent storage **
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["createhd", "--filename", "secondDisk.vdi", "--size", "5000"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...
Progress state: E_INVALIDARG
VBoxManage.exe: error: Failed to create medium
VBoxManage.exe: error: Cannot register the hard disk 'C:\Projects\GitHub\test\secondDisk.vdi' {8166ff94-8866-44c9-93d8-18023f14d47b} because a hard disk 'C:\Projects\GitHub\test\secondDisk.vdi' with UUID {2e06f6f0-e768-4e07-a5f1-de1412fdb409} already exists
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component VirtualBoxWrap, interface IVirtualBox
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreateMedium(struct HandlerArg *)" at line 450 of file VBoxManageDisk.cpp

How do I destroy the vdi?

Disk operations script not found

I have the following config set for a Gentoo box:

config.persistent_storage.enabled = true
config.persistent_storage.location = "vagrant-mysql.vdi"
config.persistent_storage.size = 200000
config.persistent_storage.mountname = 'mysql'
config.persistent_storage.filesystem = 'ext4'
config.persistent_storage.mountpoint = '/var/lib/mysql'
config.persistent_storage.volgroupname = 'vagrant'

When I vagrant up, I get:

C:/Users/Courtney/.vagrant.d/gems/gems/vagrant-persistent-storage-0.0.6/lib/vagrant-persistent-storage/manage_storage.rb:74:in `initialize': No such file or directory - /tmp/disk_operations_mysql.sh (Errno::ENOENT)

Is there a config I'm missing or something?

I'm running vagrant 1.4.1, under Windows 7.

boot2docker: no bash available, /etc/fstab not writable

I'm trying to set up some persistent storage with the dduportal/boot2docker vagrant box, but mounting the volume fails. The /tmp/disk_operations_boot2docker-data.sh script fails to execute, as bash is not available in boot2docker. Also, /etc/fstab is not writable (as boot2docker runs from an iso).

Changing the disk_operations script to use /bin/sh fails with the following errors:
sh: LABEL="boot2docker-data": unknown operand
mke2fs 1.42.7 (21-Jan-2013)
mkfs.ext4: No such device or address while trying to determine filesystem size
mkdir: can't create directory '/data': Permission denied
/tmp/disk_operations_boot2docker-data.sh: line 16: can't create /etc/fstab: Permission denied
mount: can't find /data in /etc/fstab

Any suggestions on how to make this work with boot2docker?

not on rubygems

I can't gem install vagrant-persistent-storage, and I also couldn't find it by seraching on the Rubygems website.

Was it there in the past?

For now I'm just pointing to github in my Gemfile.

Windows: \r\n issue

Plugin has serious issue - it does not work correctly on host windows system (windows 8 in my case). As I found, file /tmp/disk_operations_persistent.sh has windows-style EOL ending (\r\n instead of \n), and because of that cannot be executed on startup as is.

I tried to overcome issue by converting this file with dos2unix command on startup and then executing, but anyway it is kludge, you see. Please fix...

Never ending boot

Host Windows 8.1
Vagrant version: 1.6.3
version 0.0.12
box ubuntu/trusty64

Everything is working fine at the first time, until I restart( vagrant halt, vagrant up)
The boot process is never ending for the second time.

Running smoothly when I test it on hashicorp/precise32 box. Can we add the list of supported box (well tested) in the readme?

VirtualBox Storage does not get removed from Virtual Media Manager

I have a multiple VM setup similar to #50.
When the VM is destroyed the storage file is deleted, but the disk is not deregistered from Virtialbox's Virtual Media Manager.
I am using virtualbox 5.1.18, Vagrant 1.9.5, vagrant-persistent-storage (0.0.26) on Ubuntu
As such I am getting the following error when I try to create the host for a second time

==> localdev: ** Creating persistent storage **
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["createhd", "--filename", "/home/removed/.vagrant/machines/localdev/virtualbox/localdev_opt_oracle.vdi", "--size", "75000"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...
Progress state: NS_ERROR_INVALID_ARG
VBoxManage: error: Failed to create medium
VBoxManage: error: Cannot register the hard disk '/home/removed/.vagrant/machines/localdev/virtualbox/localdev_opt_oracle.vdi' {5cf19295-c49b-4b1f-a52b-f67c1842a629} because a hard disk '/home/removed/.vagrant/machines/localdev/virtualbox/localdev_opt_oracle.vdi' with UUID {de059dcd-5817-413b-ac77-f1404b290d63} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBoxWrap, interface IVirtualBox
VBoxManage: error: Context: "RTEXITCODE handleCreateMedium(HandlerArg*)" at line 450 of file VBoxManageDisk.cpp

My Vagrantfile is

# -*- mode: ruby -*-
# vi: set ft=ruby :
@required_plugins = [ 'vagrant-vbguest', 'vagrant-reload', 'vagrant-persistent-storage' ]

require_relative "vagrant_requires.rb"

boxUrl_oracleLinux6 = 'elastic/oraclelinux-6-x86_64'
boxUrl_oracleLinux7 = 'elastic/oraclelinux-7-x86_64'

software_folder               = "~/software"

hosts = [
  { name: 'python3',    hostname: 'python3.localdev',                         memory:'512',  cpu: 1, box: 'oracle7dhcp',   port_forward: [], },
  { name: 'localdev',   hostname: 'localdev.localdev',  ip: '192.168.56.35',  memory:'8192', cpu: 2, box: 'oracle6static', port_forward: [{guest:'80', host: '8080'},{guest:'443', host:'8443'}], },
]

Vagrant.configure("2") do |config|
  hosts.each do |host|
    config.vm.define host[:name] do |node|
      node.vm.box = host[:box]
      case host[:box]
        when 'oracle6static'
          node.vm.box = boxUrl_oracleLinux6
          opt_oracle  = ".vagrant/machines/#{host[:name]}/virtualbox/#{host[:name]}_opt_oracle.vdi"
          node.persistent_storage.enabled     = true
          node.persistent_storage.size        = 75000
          node.persistent_storage.location    = opt_oracle
          node.persistent_storage.mountname   = 'opt_oracle'
          node.persistent_storage.filesystem  = 'ext4'
          node.persistent_storage.mountpoint  = '/opt/oracle'
          node.persistent_storage.volgroupname = 'opt_oracle'
          node.vm.network :private_network, ip: host[:ip], netmask: '255.255.255.0'
        when 'oracle7static'
          node.vm.box = boxUrl_oracleLinux7
          node.vm.network :private_network, ip: host[:ip], netmask: '255.255.255.0'
        when 'oracle7dhcp'
          node.vm.box = boxUrl_oracleLinux7
          node.vm.network :private_network, type: "dhcp"
        else
          config.vm.box = "bento/centos-6.7"
      end
      node.vm.hostname = host[:hostname]
      node.vm.provider :virtualbox do |vb|
        modifyvm_args = ['modifyvm', :id]
        modifyvm_args << "--memory" << host[:memory]
        modifyvm_args << "--cpus" << host[:cpu]
        modifyvm_args << "--name" << host[:hostname]
        modifyvm_args << "--ioapic" << "on"
        modifyvm_args << "--natdnshostresolver1" << "on"
        vb.customize(modifyvm_args)
      end
      if !host[:port_forward].empty? then
        host[:port_forward].each do |forward_rule|
          node.vm.network "forwarded_port", guest: forward_rule[:guest], host: forward_rule[:host], auto_correct: true
        end
      end
      case host[:box]
        when 'oracle6static'
          node.vm.provision :shell, :path => 'scripts/6/prep.vm.sh'
          node.vm.provision :shell, :path => 'scripts/6/oracle6.sh'
          node.vm.synced_folder software_folder, '/opt/software',  :create => true, :owner => 'vagrant', :group => 'vagrant', :mount_options => ['dmode=775', 'fmode=775']
        when 'oracle7static'
          node.vm.provision :shell, :path => 'scripts/7/prep.vm.sh'
          node.vm.provision :shell, :path => 'scripts/7/oracle7.sh'
        when 'oracle7dhcp'
          node.vm.provision :shell, :path => 'scripts/7/prep.vm.sh'
          node.vm.provision :shell, :path => 'scripts/7/oracle7.sh'
        else
          node.vm.provision :shell, :path => 'scripts/provision.sh'
      end
      node.vbguest.auto_update = true
    end
  end
end

bash 3.1 incompatible

The script is not compatible for bash 3.1
error:

/tmp/disk_operations_data.sh: line 3: unexpected argument (' to conditional binary operator /tmp/disk_operations_data.sh: line 3: syntax error near (['
/tmp/disk_operations_data.sh: line 3: `[[ $("sfdisk" --version) =~ ([0-9][.][0-9.][0-9.]) ]] && version="${BASH_REMATCH[1]}"'

To fix that, the brakes around regular expression should remove and use simple full match.

-[[ $("sfdisk" --version) =~ ([0-9][.][0-9.]*[0-9.]*) ]] && version="${BASH_REMATCH[1]}"
+[[ $("sfdisk" --version) =~ [0-9][.][0-9.]*[0-9.]* ]] && version="${BASH_REMATCH}"

see comments in http://mywiki.wooledge.org/BashGuide/Patterns#line-114

conflicting dependencies childprocess (= 0.5.9) and childprocess (= 0.6.3)

I have macOS 10.12.6, which i have just updated to. and when i try to install, i get the following error:

Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

conflicting dependencies childprocess (= 0.5.9) and childprocess (= 0.6.3)
  Activated childprocess-0.6.3
  which does not match conflicting dependency (= 0.5.9)

  Conflicting dependency chains:
    childprocess (= 0.6.3), 0.6.3 activated

  versus:
    childprocess (= 0.5.9)

  Gems matching childprocess (= 0.5.9):
    childprocess-0.5.9```

Vagrant 1.7.2 prompts for password when config.persistent_storage.enabled = true

After "vagrant up" with the Vagrantfile below, I'm prompted to enter a password when I "vagrant ssh".

If I set "config.persistent_storage.enabled = false" and "vagrant up", "vagrant ssh" correctly uses the ssh key and just logs in.

OS X 10.10.2
Vagrant 1.7.2
vagrant-hostmanager (1.5.0)
vagrant-persistent-storage (0.0.15)
vagrant-share (1.1.3, system)
vagrant-vbguest (0.10.0)

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

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # The URL that the configured box can be found at
  #config.vm.box_url = "http://repository.orbitz.net/vagrant/centos-6-5-x64-virtualbox.box"
  config.vm.box = "hashicorp/precise32"


  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # config.vm.network "forwarded_port", guest: 80, host: 8080
  config.vm.network "forwarded_port", guest: 5008, host: 5008 # Debug app


  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"
  if RbConfig::CONFIG['host_os'] =~ /darwin/ # use nfs for performance on OS X since it is available without any setup needed
    config.vm.synced_folder "~", "/host_profile_home", nfs: true
  else
    config.vm.synced_folder "~", "/host_profile_home"
  end

  # If true, then any SSH connections made will enable agent forwarding.
  # Default value: false
  config.ssh.forward_agent = true

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  config.vm.provider "virtualbox" do |vb|

    # Speed up dns
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    vb.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000 ]
    host = RbConfig::CONFIG['host_os']

    # Give VM 1/4 system memory & access to all physical cpu cores on the host
    if host =~ /darwin/
      cpus = `sysctl -n hw.ncpu`.to_i
      # sysctl returns Bytes and we need to convert to MB
      vb.memory = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4

    elsif host =~ /linux/
      cpus = `nproc`.to_i
      # meminfo shows KB and we need to convert to MB
      vb.memory = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4

    else 
      cpus = ENV['NUMBER_OF_PROCESSORS'].to_i
      vb.memory = 4096
    end

    # OSs report number of logical cores, including hyper-threads. Per VBox docs, it's best to not assign more then the number of physical cores, so divide by two
    vb.cpus = cpus / 2 

    # Don't boot with headless mode
    # vb.gui = true

    # Use VBoxManage to customize the VM. For example to change memory:
    if vb.gui =~ true
      vb.customize ["modifyvm", :id, "--vram", "128"]
      vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
      vb.customize ["modifyvm", :id, "--accelerate2dvideo", "on"]
    end

  end

$script = <<SCRIPT
  echo 'Fix dhcp issue'
  echo '# this is needed to fix an issue where dhcp is not updated properly after restarting following vagrant halt' 
  echo '# see https://github.com/mitchellh/vagrant/issues/391 for more background' 
  echo '/sbin/service network restart' >> /etc/rc.local

SCRIPT


  config.vm.provision "shell", inline: $script


  config.persistent_storage.enabled = true
  config.persistent_storage.location = "~/guest-config/persistent_user_disk.vdi"
  config.persistent_storage.size = 30000
  config.persistent_storage.mountname = 'user_disk'
  config.persistent_storage.filesystem = 'ext4'
  config.persistent_storage.mountpoint = '/home/vagrant'
  config.persistent_storage.volgroupname = 'myvolgroup'  
end

sfdisk incompatibility in version 2.26

My Guest OS:

on vagrant up, following command from manage_storage.rb is executed:

[ -b #{disk_dev}1 ] || echo 0,,8e | sfdisk #{disk_dev}

unfortunately it will not work with sfdisk >=2.26

file disk_operation_log.txt:

fdisk returned:  1
ext4 creation return:  1
fstab update returned:  0
/data_hdd mounting returned:  32

manual execution of sudo /tmp/disk_operations_hdd.sh:

Checking that no-one is using this disk right now ... OK

Disk /dev/sdb: 48.8 GiB, 52428800000 bytes, 102400000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

>>> Created a new DOS disklabel with disk identifier 0xe7b6e7a2.
Start sector 0 out of range.
Failed to add partition: Numerical result out of range
Leaving.

mke2fs 1.42.10 (18-May-2014)
mkfs.ext4: Device size reported to be zero.  Invalid partition specified, or
    partition table wasn't reread after running fdisk, due to
    a modified partition being busy and in use.  You may need to reboot
    to re-read your partition table.

mount: /dev/sdb1 is not a block device (maybe try `-o loop'?)

fix is to change the command to:
[ -b #{disk_dev}1 ] || echo ,,8e | sfdisk #{disk_dev}

Install fails on ubuntu 16.04

On a reasonably clean Ubuntu 16.04 LTS x64 with Vagrant 1.8.1 and ruby 2.3.0p0 (2015-12-25) installation fails with an undecipherable error:

$ vagrant plugin install vagrant-persistent-storage
Installing the 'vagrant-persistent-storage' plugin. This can take a few minutes...
/usr/lib/ruby/2.3.0/rubygems/specification.rb:946:in `all=': undefined method `group_by' for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:275:in `with_isolated_gem'
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:231:in `internal_install'
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:102:in `install'
    from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:62:in `block in install_plugin'
    from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:72:in `install_plugin'
    from /usr/share/vagrant/plugins/commands/plugin/action/install_gem.rb:37:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/warden.rb:34:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/builder.rb:116:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `block in run'
    from /usr/lib/ruby/vendor_ruby/vagrant/util/busy.rb:19:in `busy'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `run'
    from /usr/share/vagrant/plugins/commands/plugin/command/base.rb:14:in `action'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:32:in `block in execute'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `each'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `execute'
    from /usr/share/vagrant/plugins/commands/plugin/command/root.rb:56:in `execute'
    from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:42:in `execute'
    from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:268:in `cli'
    from /usr/bin/vagrant:173:in `<main>'

Better documentation

This plugin seems really cool!

I would guess it supports a use-case like having your MYSQL databases not blown away when you run vagrant destroy, with the main benefit over standard Virtualbox shared folders (which are also persistent) is speed.

It would be great to see a tutorial (eg blog post) about how it's used, what else it's good for. Also a Vagrantfile for quick testing/hacking might be useful.

I haven't had a chance to try this plugin yet, but here are some other questions I'm wondering about:

  • what (if anything) will eventually destroy ~/development/sourcehdd.vdi?
  • is it possible to mount ~/development/sourcehdd.vdi to multiple VMs, or is there a check against that?
  • standard VM images seem to live under /Users/dergachev/VirtualBox VMs... should the persistent images also be stored there?
  • does this plugin work with VBoxManage snapshot?

Cheers,

Encryption Support

Would be great to add encryption support; available since Virtualbox 5.0.4

Pass additional options to mkfs

I would like to be able to pass additional options when a filesystem is being created. Specifically, I would like to set the bytes per inode on an ext4 filesystem for my use case. Right now I have to unmount it and recreate the filesystem using mkfs.ext4 -i 8192 /dev/sdb1. I would like to do this as part of the persistent_storage configuration.

Doesn't work with ubuntu/xenial64

Hi,

This plugin seems to not work with the current LTS release of Ubuntu. I'm afraid I don't understand this stuff well enough yet, but I'm pretty sure that Trusty uses a SATA controller for it's disk, whereas Xenial uses SCSII.

When I try to vagrant up, not a lot happens, connecting directly to the box it's plain to see why...
image

plugin not loading?

Hey guys,

Here is my Vagrantfile,
https://gist.github.com/hardikdangar/94dfcdf62e322ebfae5c

I am using following versions of virtualbox and vagrant
Vagrant 1.7.2
Virtualbox 4.3.26

When i vagrant up nothing happens. i even tried to restart the operating system ( Ubuntu 14.04 ).

Output of Vagrant up Command is,

Bringing machine 'HARDDISKHOST' up with 'virtualbox' provider...
==> HARDDISKHOST: Clearing any previously set forwarded ports...
==> HARDDISKHOST: Clearing any previously set network interfaces...
==> HARDDISKHOST: Preparing network interfaces based on configuration...
    HARDDISKHOST: Adapter 1: nat
==> HARDDISKHOST: Forwarding ports...
    HARDDISKHOST: 22 => 2222 (adapter 1)
==> HARDDISKHOST: Running 'pre-boot' VM customizations...
==> HARDDISKHOST: Booting VM...
==> HARDDISKHOST: Waiting for machine to boot. This may take a few minutes...
    HARDDISKHOST: SSH address: 127.0.0.1:2222
    HARDDISKHOST: SSH username: vagrant
    HARDDISKHOST: SSH auth method: private key
    HARDDISKHOST: Warning: Connection timeout. Retrying...
    HARDDISKHOST: Warning: Remote connection disconnect. Retrying...
==> HARDDISKHOST: Machine booted and ready!
==> HARDDISKHOST: Checking for guest additions in VM...
==> HARDDISKHOST: Mounting shared folders...
    HARDDISKHOST: /vagrant => /home/hardik/hardik/vm/harddisk
==> HARDDISKHOST: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> HARDDISKHOST: to force provisioning. Provisioners marked to run always will still run.

Plugin does not work w/ Vagrant >= 1.1.x

The following error can be found in the logs:

 INFO vagrant: `vagrant` invoked: ["up"]
 INFO environment: Environment initialized (#<Vagrant::Environment:0x25d8860>)
 INFO environment:   - cwd: C:/cw/home/kiesel/dev/bit_config/svc/config/development
 INFO environment: Home path: C:/Users/kiesel/.vagrant.d
 INFO environment: Local data path: C:/cw/home/kiesel/dev/bit_config/svc/config/development/.vagrant
 INFO environment: Loading plugin from JSON: vagrant-persistent-storage
ERROR root: Failed to load plugin: vagrant-persistent-storage
ERROR root:  -- Error: #<NameError: uninitialized constant Vagrant::Config::Base>
ERROR root:  -- Backtrace:
ERROR root: C:/Users/kiesel/.vagrant.d/gems/gems/vagrant-persistent-storage-0.0.2/lib/vagrant-persistent-storage/config.rb:2:in `<module:VagrantPersistentStorage>'
C:/Users/kiesel/.vagrant.d/gems/gems/vagrant-persistent-storage-0.0.2/lib/vagrant-persistent-storage/config.rb:1:in `<top (required)>'
C:/vagrant/Vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
C:/vagrant/Vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
C:/Users/kiesel/.vagrant.d/gems/gems/vagrant-persistent-storage-0.0.2/lib/vagrant-persistent-storage.rb:3:in `<top (required)>'
C:/vagrant/Vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
C:/vagrant/Vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
C:/vagrant/Vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
C:/vagrant/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant.rb:186:in `require_plugin'
C:/vagrant/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/environment.rb:768:in `block in load_plugins'
C:/vagrant/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/environment.rb:765:in `each'
C:/vagrant/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/environment.rb:765:in `load_plugins'
C:/vagrant/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/environment.rb:132:in `initialize'
C:/vagrant/Vagrant/embedded/gems/gems/vagrant-1.2.2/bin/vagrant:62:in `new'
C:/vagrant/Vagrant/embedded/gems/gems/vagrant-1.2.2/bin/vagrant:62:in `<top (required)>'
C:/vagrant/Vagrant/bin//../embedded/../embedded/gems/bin/vagrant:23:in `load'
C:/vagrant/Vagrant/bin//../embedded/../embedded/gems/bin/vagrant:23:in `<main>'
 INFO interface: error: Failed to load the "vagrant-persistent-storage" plugin. View logs for more details.

Failed to load the "vagrant-persistent-storage" plugin. View logs for more details.

Create VDI With Initial Size

I know on vagrant up that my attached vdi is going to grow immediately to 20GB due to the import of a database dump.

Rather than have the vdi start small then keep dynamically increasing, is it possible to set the initial vdi size?

Cannot install using vagrant plugin install

Hello everyone,

I can't install this plugin using:
vagrant plugin install vagrant-persistent-storage

Installing the 'vagrant-persistent-storage' plugin. This can take a few minutes...
/usr/lib/ruby/2.3.0/rubygems/specification.rb:946:in `all=': undefined method `group_by' for nil:NilClass (NoMethodError)
from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:275:in `with_isolated_gem'
from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:231:in `internal_install'
from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:102:in `install'
from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:62:in `block in install_plugin'
from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:72:in `install_plugin'
from /usr/share/vagrant/plugins/commands/plugin/action/install_gem.rb:37:in `call'
from /usr/lib/ruby/vendor_ruby/vagrant/action/warden.rb:34:in `call'
from /usr/lib/ruby/vendor_ruby/vagrant/action/builder.rb:116:in `call'
from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `block in run'
from /usr/lib/ruby/vendor_ruby/vagrant/util/busy.rb:19:in `busy'
from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `run'
from /usr/share/vagrant/plugins/commands/plugin/command/base.rb:14:in `action'
from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:32:in `block in execute'
from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `each'
from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `execute'
from /usr/share/vagrant/plugins/commands/plugin/command/root.rb:56:in `execute'
from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:42:in `execute'
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:268:in `cli'
from /usr/bin/vagrant:173:in `<main>'

I'm using:

  • Ubuntu 16.04.1 LTS
  • Vagrant 1.8.1
  • VirtualBox 5.0.24_Ubuntu r108355
  • Ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

The line is almost this one (the apt-get version is not exactly the same one as the last one on github)
https://github.com/rubygems/rubygems/blob/master/lib/rubygems/specification.rb#L950

If this is not something that happens to more people let me know, then I can try some other configurations.

have a nice day.

VMWare / VMware fusion support?

Can you please specify in documentation which providers are supported by your plugin?
I'm about to buy licence for vagrant VMWare plugin, but if there will be no persistent storage - it will not have much sense.

Thanks in advance.

Argument Error on Vagrant up

When I try to attach the disk, I get always the argument error that is showed in the image. Could you help to troubleshot it?
captura de pantalla 2014-05-07 16 49 57

Plugin does to seem to work with Vagrant 1.9.1

Your plugin does to seem to work at all with Vagrant 1.9.1 here. Host and guest are both Debian 8. The config is pretty c&p from docs:

config.persistent_storage.enabled = true
config.persistent_storage.location = "~/vdi/ftp.vdi"
config.persistent_storage.size = 5000
config.persistent_storage.mountname = 'ftp'
config.persistent_storage.filesystem = 'xfs'
config.persistent_storage.mountpoint = '/FTP'
config.persistent_storage.use_lvm = false

Nothing happens on vagrant up and the ~/vdi folder remains empty. I also tried with vbguest installed but that makes no difference.

Is it me or plugin is not working with recent Vagrant?

Cannot attach storage to controller

With version 0.0.6, setting up a new box, the plugin fails like this:

[default] ** Creating adapter for persistent storage **
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["storagectl", "88df651e-864b-4f72-93cf-80a1903c8532", "--name", "SATA Controller", "--sataportcount", "2"]

Stderr: VBoxManage.exe: error: Could not find a storage controller named 'SATA Controller'
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component SessionMachine, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "GetStorageControllerByName(Bstr(pszCtl).raw(), ctl.asOutParam())" at line 1132 of file VBoxManageStorageController.cpp
VBoxManage.exe: error: Couldn't find the controller with the name: 'SATA Controller'

After I have renamed the SATA controller though the VirtualBox frontend to SATA Controller it went through fine.

I am running:

  • VirtualBox 4.2.18 r88780
  • vagrant 1.3.5

Doesn't Seem to Work w/ 1.6.2

I don't know why but nothing happens during vagrant up/destroy despite I installed the plugin and wrote the configs as in README.

use_lvm=true should default mount & format false

If you are using the LVM, you don't want to modify fstab or format the volume.

I'm using this for a docker thinpool, which means I need to wipe signatures. Even though I supply "y" to lvcreate, it still fails with a prompt:

lvcreate --wipesignatures y -n thinpool docker -l 95%VG
WARNING: ext3 signature detected on /dev/docker/thinpool at offset 1080. Wipe it? [y/n]:

Also, the logical volume created is changed so /etc/fstab is incorrect after that change. LVM already manages the mount table so I don't think you ever want vagrant-persistent-storage to modify it with use_lvm=true.

Ideally, if you were to specify a volgroupname, use_lvm should default to true, too, but that's less problematic.

Variable handling incompatible with vagrant 1.5

After updating vagrant to 1.5, performing a vagrant up results in the following:

/Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/plugin/v2/config.rb:73:in `method_missing': undefined local variable or method `mount_point' for #<VagrantPlugins::PersistentStorage::Config:0x000001012d5b70> (NameError)
    from /Users/*****/.vagrant.d/gems/gems/vagrant-persistent-storage-0.0.10/lib/vagrant-persistent-storage/config.rb:118:in `validate'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/config/v2/root.rb:68:in `block in validate'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/config/v2/root.rb:64:in `each'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/config/v2/root.rb:64:in `validate'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/builtin/config_validate.rb:15:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/builtin/call.rb:57:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/runner.rb:69:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/action/runner.rb:69:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/machine.rb:157:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.0/lib/vagrant/batch_action.rb:72:in `block (2 levels) in run'

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

0.0.18 is broken with hotplug errors

I get the following error now:

=> pcobox: ** Attaching persistent storage **
There was an error while executing VBoxManage, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["storageattach", "87e69694-8e0d-4474-bd06-472b6473b7c4", "--storagectl", "IDE Controller", "--port", "1", "--device", "0", "--type", "hdd", "--medium", "data/.pco-box_perm.vdi", "--hotpluggable", "on"]

Stderr: VBoxManage: error: Controller 'IDE Controller' does not support changing the hot-pluggable device flag
VBoxManage: error: Details: code VBOX_E_NOT_SUPPORTED (0x80bb0009), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "SetHotPluggableForDevice(Bstr(pszCtl).raw(), port, device, TRUE)" at line 881 of file VBoxManageStorageController.cpp

My config is as follows:

config.persistent_storage.enabled = true
config.persistent_storage.location = "data/.pco-box_perm.vdi"
config.persistent_storage.size = 20000
config.persistent_storage.mountname = 'persistvol'
config.persistent_storage.filesystem = 'ext4'
config.persistent_storage.mountpoint = '/opt/persist'
config.persistent_storage.volgroupname = 'persist'
config.persistent_storage.mountoptions = ['defaults', 'relatime']

Detection for LVM

The latest version of ubuntu comes without installed lvm.
Add support for auto detection. If not available use config.persistent_storage.use_lvm = false

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.