Git Product home page Git Product logo

Comments (9)

kusnier avatar kusnier commented on June 1, 2024 2

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.

from vagrant-persistent-storage.

kojiwell avatar kojiwell commented on June 1, 2024 2

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.

from vagrant-persistent-storage.

dseevr avatar dseevr commented on June 1, 2024 2

@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

from vagrant-persistent-storage.

syntacticvexation avatar syntacticvexation commented on June 1, 2024

That'd be great thanks.

from vagrant-persistent-storage.

rahulpowar avatar rahulpowar commented on June 1, 2024

+1 for this

from vagrant-persistent-storage.

marcindulak avatar marcindulak commented on June 1, 2024

+1

from vagrant-persistent-storage.

coderlol avatar coderlol commented on June 1, 2024

Did it get implemented?

from vagrant-persistent-storage.

cswingler avatar cswingler commented on June 1, 2024

+1 for this as well

from vagrant-persistent-storage.

sporniket avatar sporniket commented on June 1, 2024

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.

from vagrant-persistent-storage.

Related Issues (20)

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.