I encountered an error message when I installed Cloud Foundry in ubuntu installed with VirtualBox, and the disk space is insufficient:
After cleaning up with these three commands, the result is still not ideal:
(1) sudo apt-get autoclean (installation package of uninstalled software)
(2) sudo apt-get clean (the installation package of the software is not uninstalled)
(3) Clean up orphaned packages that are no longer needed by the system. sudo apt-get autoremove
So I decided to adjust the size of the ubuntu virtual machine disk to 30G.
The current disk space can be viewed through the command line VBoxManage.exe list hdds.
Use the command VBoxManage.exe modifyhd -resize to change the size. After I changed to 30G,
I have seen the size take effect in VirtualBox.
The ubuntu command sudo fdisk -l can see that the new disk size has taken effect.
But the size of the file system viewed by df -H has not changed.
Use the command sudo fdisk /dev/sda, and then select n to create a new partition, the type is p, and the number is 3. Note here that the start position of the new partition should be close to the end position of the existing Linux LVM partition, as shown in the figure below. As for the end position, I simply specified it to increase by 15G, so the end position is calculated dynamically.
The following information shows that the partition has been successfully created.
Change the type of the newly created partition to 8e: Linux LVM
The next step is to create a new Physical volume: sudo pvcreate /dev/sda3
sudo pvscan shows that the physical volume has not been assigned to the volume group ubuntu-vg
Use the command sudo vgextend ubuntu-vg /dev/sda3 to allocate:
The allocation is complete.
Then modify the size of the volume group: sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-root
last step:
sudo resize2fs /dev/mapper/ubuntu–vg-root
Now the size of / directory has been successfully expanded:
Recommended Posts