-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for primary disk resizing
- Update Vagrantfile to include disks method - Update vagrant.yaml to include the new disks config - Update lib/vagrant-host.rb with new disks method - Update documentation, add disks.md section - Update ansible roles, add new system/disks role
- Loading branch information
1 parent
49c5973
commit 714acc6
Showing
17 changed files
with
160 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Overview | ||
|
||
Vagrant Disks is a feature that allows users to define what mediums should be attached to their guests, as well as allowing users to **resize** their primary disk. | ||
|
||
# Supported providers | ||
|
||
Currently, only **VirtualBox** is supported. Please refer to the [VirtualBox documentation](https://developer.hashicorp.com/vagrant/docs/disks/virtualbox) for more information on using disks with the VirtualBox provider! | ||
|
||
# Customizations | ||
|
||
This feature requires the following environmental flag to be used: | ||
|
||
```console | ||
export VAGRANT_EXPERIMENTAL="disks" | ||
``` | ||
|
||
!!! info "Reload Vagrant" | ||
You will need to reload vagrant from the command line for resizing to take affect. | ||
|
||
Multiple disks can be added in the ``vagrant.yaml`` configuration file but only the disk with the ``:primary: true`` | ||
option is what tells to vagrant to *expand* the guests main drive. Without this option, vagrant will instead attach a *new* | ||
disk to the guest. | ||
|
||
```yaml | ||
:host: | ||
:disks: | ||
- :type: 'disk' | ||
:options: | ||
:primary: true | ||
:size: '80GB' | ||
- :type: 'disk' | ||
:options: | ||
:size: '40GB | ||
``` | ||
- If Vagrant is provisioned for the first time the [local ansible provisioner](../provisioners/#local-ansible-provisioner) will take care of</br> the logical volume and filesystem resizing. | ||
- If Vagrant is **already provisioned** then you will need to execute: | ||
```console | ||
vagrant provision --provision-with sandbox | ||
``` | ||
or | ||
from inside the Vagrant box: | ||
```console | ||
cd /shared/provisioners/ansible | ||
ansible-playbook -i inventory.yml playbook.yml --tags resize_disk | ||
``` | ||
Supported options are: | ||
- ``type``: The kind of the disk type, current accepts: | ||
- *disk* | ||
- *dvd* | ||
- *flopppy* | ||
- ``options``: | ||
- ``primary``: Configures disk to be the *primary* disk t o manae on the guest. | ||
- ``size``: The size of the disk to create. For example *10GB*. Not used for type *dvd*. | ||
# Limitations | ||
- Disks can only be **increased** in size. There is no facility to shrink a disk. | ||
- Depending on the guest, you may need to resize the partition and the filesystem</br>from within the guest. | ||
- Vagrant attaches all new disks defined to guests's primary controller. As of Virtualbox *6.1.x*</br> | ||
storage controllers have the following limits to the number of disks that are supported per guest: | ||
|
||
- IDE Controllers: 4 | ||
- SATA Controllers: 30 | ||
- SCSI Controllers: 16 | ||
|
||
# References | ||
|
||
- [vagrant-disks](https://developer.hashicorp.com/vagrant/docs/disks) | ||
- [vagrant-disksize-plugin](https://github.com/sprotheroe/vagrant-disksize) | ||
- [increasing-disk-space-vagrant-box](https://marcbrandner.com/blog/increasing-disk-space-of-a-linux-based-vagrant-box-on-provisioning/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
--- | ||
repositories: | ||
- name: 'vagrantenv' | ||
src: 'git@github.com:theodore86/vagrantenv.git' | ||
dest: '{{ ansible_env.HOME }}' | ||
version: 'main' | ||
pull: true | ||
remote: 'origin' | ||
- name: 'sublime' | ||
src: 'git@github.com:theodore86/sublime.git' | ||
dest: '{{ ansible_env.HOME }}' | ||
version: 'master' | ||
pull: true | ||
remote: 'origin' | ||
# - name: 'vagrantenv' | ||
# src: 'git@github.com:theodore86/vagrantenv.git' | ||
# dest: '{{ ansible_env.HOME }}' | ||
# version: 'main' | ||
# pull: true | ||
# remote: 'origin' | ||
repositories: [] | ||
... |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
disks_dependencies: | ||
- 'lvm2' | ||
disks_pvs: '/dev/sda3' | ||
disks_vg_name: 'ubuntu-vg' | ||
disks_lv_name: 'ubuntu-lv' | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
- name: 'Install disks dependencies' | ||
apt: | ||
name: '{{ disks_dependencies }}' | ||
state: 'present' | ||
force_apt_get: 'yes' | ||
install_recommends: 'no' | ||
become: 'yes' | ||
|
||
- name: 'Resize volume-group {{ disks_pvs }} to the maximum possible' | ||
lvg: | ||
vg: '{{ disks_vg_name }}' | ||
pvs: '{{ disks_pvs }}' | ||
pvresize: 'yes' | ||
state: 'present' | ||
become: 'yes' | ||
|
||
- name: > | ||
Extend the logical volume to take all remaining space | ||
of the PVs and resize the underlying filesystem. | ||
lvol: | ||
vg: '{{ disks_vg_name }}' | ||
lv: '{{ disks_lv_name }}' | ||
size: '100%PVS' | ||
resizefs: 'yes' | ||
state: 'present' | ||
become: 'yes' | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters