Created
October 15, 2021 10:02
-
-
Save edwint88/8fe290d185a72131ad87150027e5a635 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
install Vagrant plugin vagrant-disksize | |
vagrant plugin install vagrant-disksize | |
If you want to add make sure user has the plugin installed when starting vagrant you can add this in the beginning of Vagrantfile | |
# Install vagrant-disksize to allow resizing the vagrant box disk. | |
unless Vagrant.has_plugin?("vagrant-disksize") | |
raise Vagrant::Errors::VagrantError.new, "vagrant-disksize plugin is missing. Please install it using 'vagrant plugin install vagrant-disksize' and rerun 'vagrant up'" | |
end | |
Set desired disk size in Vagrantfile | |
vagrant.configure('2') do |config| | |
config.disksize.size = '50GB' | |
end | |
Updating existing vagrant box | |
Do all of the above | |
Run vagrant halt & vagrant up (You should see something like "Resized disk: old 32768 MB, req 51200 MB, new 51200 MB") | |
SSH to vagrant box | |
Run sudo cfdisk /dev/sda | |
Use arrows to select your disk probably sdaX. Mine was sda3. | |
Then select resize using arrow keys. Accept the suggested disk size. | |
Then select write. And answer yes. | |
You can select quit now. | |
Run sudo resize2fs -p -F /dev/sdaX You should see something like: "Filesystem at /dev/sda3 is mounted on /; on-line resizing required old_desc_blocks = 4, new_desc_blocks = 6 The filesystem on /dev/sda3 is now 11933952 (4k) blocks long. " | |
Run df and see that your disk size has increased. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment