kusnier/vagrant-persistent-storage

failed to create disk with specified size for ubuntu 16.04

azbarcea opened this issue · 3 comments

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.

My presumption was right. For me, the fix was adding:

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

This fixed my problem when using Ubuntu 16.04 LTS cloud image box.

Thanks.