Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
27
rated 0 times [  27] [ 0]  / answers: 1 / hits: 108008  / 2 Years ago, sun, may 22, 2022, 2:23:18

I have a VM managed by Vagrant using VirtualBox on a Ubuntu host server. My Vagrant box uses the Puppetlabs Debian 6.0.7 basebox, which uses LVM for its root partition.



By default the disk is 8GB which is too small for my purposes. I would like to:




  1. Increase the size of the existing disk and the file system on it without destroying and recreating my VM.

  2. Configure Vagrant so that in future it will create a larger disk for this project.



Can anyone explain how to do this?


More From » virtualbox

 Answers
6

Personally I think it'll be easier to attach an extra virtual HDD and mount it to a proper mount point, for example /opt and move your stuff over using rsync to work around this issue, after all, puppet vagrant boxes are for testing purposes.



Reason why: VBoxManage modifyhd only works with native VDI image. However, vagrant base boxes are basically exported OVF/OVA using VMDK format.



See VirtualBox Docs




The --resize x option (where x is the desired new total space in megabytes) allows you to change the capacity of an existing image; this adjusts the logical size of a virtual disk without affecting the physical size much.[37] This currently works only for VDI and VHD formats, and only for the dynamically allocated variants, and can only be used to expand (not shrink) the capacity.




To increase the capacity of disk for Vagrant Base Box



Steps are




  1. To be able to resize the HDD, you'll have to convert it to VDI first, e.g. VBoxManage clonehd in.vmdk out.vdi --format VDI and then re-attached it (using the GUI is easier).


  2. Resize it using VBoxManage modifyhd box.vdi --resize 15360 which increases the capacity to 15GB.


  3. However this only changes the drive capacity, you will have to expand the file system for the guest afterwards. For example, use resize2fs -p -F DEVICE for ext{3,4}.



[#30420] Monday, May 23, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rmodmi

Total Points: 390
Total Questions: 122
Total Answers: 111

Location: Venezuela
Member since Mon, Oct 18, 2021
3 Years ago
;