Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two persistent storage mounts fail on startup #22

Open
syntacticvexation opened this issue Jun 23, 2014 · 9 comments
Open

Two persistent storage mounts fail on startup #22

syntacticvexation opened this issue Jun 23, 2014 · 9 comments

Comments

@syntacticvexation
Copy link

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'

@kusnier
Copy link
Owner

kusnier commented Jun 23, 2014

You can only mount a single drive. The second assignment overrides the first the former drive.
But i can add your request as feature request. Maybe i can find some free time.

@syntacticvexation
Copy link
Author

That'd be great thanks.

@rahulpowar
Copy link

+1 for this

@marcindulak
Copy link

+1

@coderlol
Copy link

Did it get implemented?

@kojiwell
Copy link

kojiwell commented Jul 4, 2016

For someone who ends up here, I'll share the basic idea of workaround without using this plugin. The following Vagrantfile will provide 50GB /dev/sdb and 100GB /dev/sdc.

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

Vagrant.configure(2) do |config|

  config.vm.box = "ubuntu/trusty64"

  config.vm.provider :virtualbox do |p|
    #
    # Add first disk
    #
    p.customize [
      'createmedium', 'disk',
      '--filename', "/tmp/sdb.vdi",
      '--format', 'VDI',
      '--size', 50 * 1024]
    p.customize [
      'storageattach', :id,
      '--storagectl', 'SATAController',
      '--port', 1,
      '--device', 0,
      '--type', 'hdd',
      '--medium', "/tmp/sdb.vdi"]
    #
    # Increase portcount for second disk
    #
    p.customize [
      'storagectl', :id,
      '--name', 'SATAController',
      '--portcount', 2]
    #
    # Add second disk
    #
    p.customize [
      'createmedium', 'disk',
      '--filename', "/tmp/sdc.vdi",
      '--format', 'VDI',
      '--size', 100 * 1024]
    p.customize [
      'storageattach', :id,
      '--storagectl', 'SATAController',
      '--port', 2,
      '--device', 0,
      '--type', 'hdd',
      '--medium', "/tmp/sdc.vdi"]
  end

end

NOTE: 1) Increasing --portcount to the number of disks is important. 2) The variable for --storagectl depends on the box you use, which is usually SATAController, SATA Controller or SATA.

@dseevr
Copy link

dseevr commented Oct 12, 2016

@kjtanaka Thanks! This comment saved me after an hour of frustration. Turns out using createmedium instead of createhd was the change I needed to make.

I modified your Vagrantfile slightly so that the VM can be restarted via vagrant reload:

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

Vagrant.configure(2) do |config|

  config.vm.box = "ubuntu/trusty64"

  config.vm.provider :virtualbox do |p|
    #
    # Add first disk
    #
    unless File.exists?("/tmp/sdb.vdi")
      p.customize [
        'createmedium', 'disk',
        '--filename', "/tmp/sdb.vdi",
        '--format', 'VDI',
        '--size', 50 * 1024
      ]
    end

    p.customize [
      'storageattach', :id,
      '--storagectl', 'SATAController',
      '--port', 1,
      '--device', 0,
      '--type', 'hdd',
      '--medium', "/tmp/sdb.vdi"
    ]

    #
    # Increase portcount for second disk
    #
    p.customize [
      'storagectl', :id,
      '--name', 'SATAController',
      '--portcount', 2
    ]

    #
    # Add second disk
    #
    unless File.exists?("/tmp/sdc.vdi")
      p.customize [
        'createmedium', 'disk',
        '--filename', "/tmp/sdc.vdi",
        '--format', 'VDI',
        '--size', 100 * 1024
      ]
    end

    p.customize [
      'storageattach', :id,
      '--storagectl', 'SATAController',
      '--port', 2,
      '--device', 0,
      '--type', 'hdd',
      '--medium', "/tmp/sdc.vdi"
    ]
  end

end

@cswingler
Copy link

+1 for this as well

@sporniket
Copy link

Too bad I can't write ruby, I would have started with modifying the config.rb to be able to extract a set of configuration specifications instead of a single instance.

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

No branches or pull requests

9 participants