Search This Blog

Monday, October 8, 2018

Resize Virtual Box Ubuntu disk image and file system




Few parts to this..  

1) Firstly to get above 2TB you need to use the command line rather than GUI as it limits you to 2TB.



(e.g. resize to a 3TB drive image) 

VBoxManage modifyhd '\path\VM.vdi' --resize 3000000       



2) Use gparted to create partition or expand a partition

3) Use the following for getting disk details for a logical volume

sudo lvdisplay


From the uotput you can get the device LV Path
e.g.   /dev/ubuntu-vg/root


then to extend to  a given amount  (e.g. 700GB)

sudo lvextend -L 700G /dev/ubuntu-vg/root


then expand the file system 


sudo resize2fs /dev/ubuntu-vg/root



Note:
Substitute dev as appropriate