vagrant-persistent-storage icon indicating copy to clipboard operation
vagrant-persistent-storage copied to clipboard

Two persistent storage mounts fail on startup

Open syntacticvexation opened this issue 10 years ago • 9 comments

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'

syntacticvexation avatar Jun 23 '14 03:06 syntacticvexation

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.

kusnier avatar Jun 23 '14 18:06 kusnier

That'd be great thanks.

syntacticvexation avatar Jul 12 '14 14:07 syntacticvexation

+1 for this

rahulpowar avatar Jan 14 '15 17:01 rahulpowar

+1

marcindulak avatar Apr 28 '15 12:04 marcindulak

Did it get implemented?

coderlol avatar May 28 '15 02:05 coderlol

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.

kojiwell avatar Jul 04 '16 16:07 kojiwell

@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

dseevr avatar Oct 12 '16 22:10 dseevr

+1 for this as well

cswingler avatar Feb 10 '17 19:02 cswingler

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.

sporniket avatar May 29 '18 13:05 sporniket